Image\Adapter\AbstractAdapter
Abstract Source on GitHubAll image adapters must use this class
Phalcon\Image\Adapter\AbstractAdapter— implementsPhalcon\Image\Adapter\AdapterInterface
Uses Phalcon\Image\Enum · Phalcon\Image\Exception · Phalcon\Image\Exceptions\MissingDimensions · Phalcon\Image\Exceptions\MissingHeight · Phalcon\Image\Exceptions\MissingWidth
Method Summary
publicAdapterInterfacebackground(string $color,int $opacity = 100)Set the background color of an imagepublicAdapterInterfaceblur( int $radius )Blur imagepublicAdapterInterfacecrop(int $width,int $height,mixed $offsetX = null,mixed $offsetY = null)Crop an image to the given sizepublicAdapterInterfaceflip( int $direction )Flip the image along the horizontal or vertical axispublicintgetHeight()publicgetImage()publicstringgetMime()publicstringgetRealpath()publicintgetType()publicintgetWidth()publicAdapterInterfacemask( AdapterInterface $mask )Composite one image onto anotherpublicAdapterInterfacepixelate( int $amount )Pixelate imagepublicAdapterInterfacereflection(int $height,int $opacity = 100,bool $fadeIn = false)Add a reflection to an imagepublicstringrender(string $extension = null,int $quality = 100)Render the image and return the binary stringpublicAdapterInterfaceresize(int $width = null,int $height = null,int $master = Enum::AUTO)Resize the image to the given sizepublicAdapterInterfacerotate( int $degrees )Rotate the image by a given amountpublicAdapterInterfacesave(string $file = null,int $quality = -1)Save the imagepublicAdapterInterfacesharpen( int $amount )Sharpen the image by a given amountpublicAdapterInterfacetext(string $text,mixed $offsetX = false,mixed $offsetY = false,int $opacity = 100,string $color = "000000",int $size = 12,string $fontFile = null)Add a text to an image with a specified opacitypublicAdapterInterfacewatermark(AdapterInterface $watermark,int $offsetX = 0,int $offsetY = 0,int $opacity = 100)Add a watermark to an image with the specified opacityprotectedintcheckHighLow(int $value,int $min = 0,int $max = 100)Properties
protectedstring$fileprotectedint$heightImage heightprotectedmixed|null$image = nullprotectedstring$mimeImage mime typeprotectedstring$realpathprotectedint$typeImage type Driver dependentprotectedint$widthImage widthMethods
background()
public function background(
string $color,
int $opacity = 100
): AdapterInterface;Set the background color of an image
blur()
public function blur( int $radius ): AdapterInterface;Blur image
crop()
public function crop(
int $width,
int $height,
mixed $offsetX = null,
mixed $offsetY = null
): AdapterInterface;Crop an image to the given size
flip()
public function flip( int $direction ): AdapterInterface;Flip the image along the horizontal or vertical axis
getHeight()
public function getHeight(): int;getImage()
public function getImage();getMime()
public function getMime(): string;getRealpath()
public function getRealpath(): string;getType()
public function getType(): int;getWidth()
public function getWidth(): int;mask()
public function mask( AdapterInterface $mask ): AdapterInterface;Composite one image onto another
pixelate()
public function pixelate( int $amount ): AdapterInterface;Pixelate image
reflection()
public function reflection(
int $height,
int $opacity = 100,
bool $fadeIn = false
): AdapterInterface;Add a reflection to an image
render()
public function render(
string $extension = null,
int $quality = 100
): string;Render the image and return the binary string
resize()
public function resize(
int $width = null,
int $height = null,
int $master = Enum::AUTO
): AdapterInterface;Resize the image to the given size
rotate()
public function rotate( int $degrees ): AdapterInterface;Rotate the image by a given amount
save()
public function save(
string $file = null,
int $quality = -1
): AdapterInterface;Save the image
sharpen()
public function sharpen( int $amount ): AdapterInterface;Sharpen the image by a given amount
text()
public function text(
string $text,
mixed $offsetX = false,
mixed $offsetY = false,
int $opacity = 100,
string $color = "000000",
int $size = 12,
string $fontFile = null
): AdapterInterface;Add a text to an image with a specified opacity
watermark()
public function watermark(
AdapterInterface $watermark,
int $offsetX = 0,
int $offsetY = 0,
int $opacity = 100
): AdapterInterface;Add a watermark to an image with the specified opacity
checkHighLow()
protected function checkHighLow(
int $value,
int $min = 0,
int $max = 100
): int;Image\Adapter\AdapterInterface
Interface Source on GitHubInterface for Phalcon\Image\Adapter classes
Phalcon\Image\Adapter\AdapterInterface
Uses Phalcon\Image\Enum
Method Summary
publicAdapterInterfacebackground(string $color,int $opacity = 100)Add a background to an imagepublicAdapterInterfaceblur( int $radius )Blur an imagepublicAdapterInterfacecrop(int $width,int $height,int $offsetX = null,int $offsetY = null)Crop an imagepublicAdapterInterfaceflip( int $direction )Flip an imagepublicintgetHeight()publicintgetWidth()publicAdapterInterfacemask( AdapterInterface $mask )Add a mask to an imagepublicAdapterInterfacepixelate( int $amount )Pixelate an imagepublicAdapterInterfacereflection(int $height,int $opacity = 100,bool $fadeIn = false)Reflect an imagepublicstringrender(string $extension = null,int $quality = 100)Render an imagepublicAdapterInterfaceresize(int $width = null,int $height = null,int $master = Enum::AUTO)Resize an imagepublicAdapterInterfacerotate( int $degrees )Rotate an imagepublicAdapterInterfacesave(string $file = null,int $quality = 100)Save an imagepublicAdapterInterfacesharpen( int $amount )Sharpen an imagepublicAdapterInterfacetext(string $text,int $offsetX = 0,int $offsetY = 0,int $opacity = 100,string $color = "000000",int $size = 12,string $fontFile = null)Adds text on an imagepublicAdapterInterfacewatermark(AdapterInterface $watermark,int $offsetX = 0,int $offsetY = 0,int $opacity = 100)Add a watermark on an imageMethods
background()
public function background(
string $color,
int $opacity = 100
): AdapterInterface;Add a background to an image
blur()
public function blur( int $radius ): AdapterInterface;Blur an image
crop()
public function crop(
int $width,
int $height,
int $offsetX = null,
int $offsetY = null
): AdapterInterface;Crop an image
flip()
public function flip( int $direction ): AdapterInterface;Flip an image
getHeight()
public function getHeight(): int;getWidth()
public function getWidth(): int;mask()
public function mask( AdapterInterface $mask ): AdapterInterface;Add a mask to an image
pixelate()
public function pixelate( int $amount ): AdapterInterface;Pixelate an image
reflection()
public function reflection(
int $height,
int $opacity = 100,
bool $fadeIn = false
): AdapterInterface;Reflect an image
render()
public function render(
string $extension = null,
int $quality = 100
): string;Render an image
resize()
public function resize(
int $width = null,
int $height = null,
int $master = Enum::AUTO
): AdapterInterface;Resize an image
rotate()
public function rotate( int $degrees ): AdapterInterface;Rotate an image
save()
public function save(
string $file = null,
int $quality = 100
): AdapterInterface;Save an image
sharpen()
public function sharpen( int $amount ): AdapterInterface;Sharpen an image
text()
public function text(
string $text,
int $offsetX = 0,
int $offsetY = 0,
int $opacity = 100,
string $color = "000000",
int $size = 12,
string $fontFile = null
): AdapterInterface;Adds text on an image
watermark()
public function watermark(
AdapterInterface $watermark,
int $offsetX = 0,
int $offsetY = 0,
int $opacity = 100
): AdapterInterface;Add a watermark on an image
Image\Adapter\Gd
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\Image\Adapter\AbstractAdapterPhalcon\Image\Adapter\Gd
Uses Phalcon\Image\Enum · Phalcon\Image\Exception · Phalcon\Image\Exceptions\ExtensionNotLoaded · Phalcon\Image\Exceptions\ImageLoadFailed · Phalcon\Image\Exceptions\TextRenderingFailed · Phalcon\Image\Exceptions\UnsupportedImageType · Phalcon\Image\Exceptions\VersionMismatch
Method Summary
public__construct(string $file,int $width = null,int $height = null)public__destruct()DestructorpublicstringgetVersion()protectedvoidprocessBackground(int $red,int $green,int $blue,int $opacity)protectedvoidprocessBlur( int $radius )protectedprocessCreate(int $width,int $height)protectedvoidprocessCrop(int $width,int $height,int $offsetX,int $offsetY)protectedvoidprocessFlip( int $direction )protectedprocessMask( AdapterInterface $mask )protectedvoidprocessPixelate( int $amount )protectedvoidprocessReflection(int $height,int $opacity,bool $fadeIn)protectedprocessRender(string $extension,int $quality)protectedvoidprocessResize(int $width,int $height)protectedvoidprocessRotate( int $degrees )protectedboolprocessSave(string $file,int $quality)protectedvoidprocessSharpen( int $amount )protectedvoidprocessText(string $text,mixed $offsetX,mixed $offsetY,int $opacity,int $red,int $green,int $blue,int $size,string $fontFile = null)protectedvoidprocessWatermark(AdapterInterface $watermark,int $offsetX,int $offsetY,int $opacity)Methods
__construct()
public function __construct(
string $file,
int $width = null,
int $height = null
);__destruct()
public function __destruct();Destructor
getVersion()
public function getVersion(): string;processBackground()
protected function processBackground(
int $red,
int $green,
int $blue,
int $opacity
): void;processBlur()
protected function processBlur( int $radius ): void;processCreate()
protected function processCreate(
int $width,
int $height
);processCrop()
protected function processCrop(
int $width,
int $height,
int $offsetX,
int $offsetY
): void;processFlip()
protected function processFlip( int $direction ): void;processMask()
protected function processMask( AdapterInterface $mask );processPixelate()
protected function processPixelate( int $amount ): void;processReflection()
protected function processReflection(
int $height,
int $opacity,
bool $fadeIn
): void;processRender()
protected function processRender(
string $extension,
int $quality
);processResize()
protected function processResize(
int $width,
int $height
): void;processRotate()
protected function processRotate( int $degrees ): void;processSave()
protected function processSave(
string $file,
int $quality
): bool;processSharpen()
protected function processSharpen( int $amount ): void;processText()
protected function processText(
string $text,
mixed $offsetX,
mixed $offsetY,
int $opacity,
int $red,
int $green,
int $blue,
int $size,
string $fontFile = null
): void;processWatermark()
protected function processWatermark(
AdapterInterface $watermark,
int $offsetX,
int $offsetY,
int $opacity
): void;Image\Adapter\Imagick
Class Source on GitHubPhalcon\Image\Adapter\Imagick
Image manipulation support. Resize, rotate, crop etc.
$image = new \Phalcon\Image\Adapter\Imagick("upload/test.jpg");
$image->resize(200, 200)->rotate(90)->crop(100, 100);
if ($image->save()) {
echo "success";
}Phalcon\Image\Adapter\AbstractAdapterPhalcon\Image\Adapter\Imagick
Uses Imagick · ImagickDraw · ImagickDrawException · ImagickException · ImagickPixel · ImagickPixelException · Phalcon\Image\Enum · Phalcon\Image\Exception · Phalcon\Image\Exceptions\CompositeFailed · Phalcon\Image\Exceptions\ExtensionNotLoaded · Phalcon\Image\Exceptions\ImageLoadFailed · Phalcon\Image\Exceptions\ResizeFailed · Phalcon\Image\Exceptions\ResourceTypeError
Method Summary
public__construct(string $file,int $width = null,int $height = null)Constructorpublic__destruct()Destroys the loaded image to free up resources.publicAbstractAdapterliquidRescale(int $width,int $height,int $deltaX = 0,int $rigidity = 0)This method scales the images using liquid rescaling method. Only supportpublicvoidsetResourceLimit(int $type,int $limit)Sets the limit for a particular resource in megabytesprotectedvoidprocessBackground(int $red,int $green,int $blue,int $opacity)Execute a background.protectedvoidprocessBlur( int $radius )Blur imageprotectedvoidprocessCrop(int $width,int $height,int $offsetX,int $offsetY)Execute a crop.protectedvoidprocessFlip( int $direction )Execute a flip.protectedvoidprocessMask( AdapterInterface $image )Composite one image onto anotherprotectedvoidprocessPixelate( int $amount )Pixelate imageprotectedvoidprocessReflection(int $height,int $opacity,bool $fadeIn)Execute a reflection.protectedstringprocessRender(string $extension,int $quality)Execute a render.protectedvoidprocessResize(int $width,int $height)Execute a resize.protectedvoidprocessRotate( int $degrees )Execute a rotation.protectedvoidprocessSave(string $file,int $quality)Execute a save.protectedvoidprocessSharpen( int $amount )Execute a sharpen.protectedvoidprocessText(string $text,mixed $offsetX,mixed $offsetY,int $opacity,int $red,int $green,int $blue,int $size,string $fontFile = null)Execute a textprotectedvoidprocessWatermark(AdapterInterface $image,int $offsetX,int $offsetY,int $opacity)Add WatermarkProperties
protectedint$version = 0Methods
__construct()
public function __construct(
string $file,
int $width = null,
int $height = null
);Constructor
__destruct()
public function __destruct();Destroys the loaded image to free up resources.
liquidRescale()
public function liquidRescale(
int $width,
int $height,
int $deltaX = 0,
int $rigidity = 0
): AbstractAdapter;This method scales the images using liquid rescaling method. Only support Imagick
setResourceLimit()
public function setResourceLimit(
int $type,
int $limit
): void;Sets the limit for a particular resource in megabytes
@link https://www.php.net/manual/en/imagick.constants.php#imagick.constants.resourcetypes
processBackground()
protected function processBackground(
int $red,
int $green,
int $blue,
int $opacity
): void;Execute a background.
processBlur()
protected function processBlur( int $radius ): void;Blur image
processCrop()
protected function processCrop(
int $width,
int $height,
int $offsetX,
int $offsetY
): void;Execute a crop.
processFlip()
protected function processFlip( int $direction ): void;Execute a flip.
processMask()
protected function processMask( AdapterInterface $image ): void;Composite one image onto another
processPixelate()
protected function processPixelate( int $amount ): void;Pixelate image
processReflection()
protected function processReflection(
int $height,
int $opacity,
bool $fadeIn
): void;Execute a reflection.
processRender()
protected function processRender(
string $extension,
int $quality
): string;Execute a render.
processResize()
protected function processResize(
int $width,
int $height
): void;Execute a resize.
processRotate()
protected function processRotate( int $degrees ): void;Execute a rotation.
processSave()
protected function processSave(
string $file,
int $quality
): void;Execute a save.
processSharpen()
protected function processSharpen( int $amount ): void;Execute a sharpen.
processText()
protected function processText(
string $text,
mixed $offsetX,
mixed $offsetY,
int $opacity,
int $red,
int $green,
int $blue,
int $size,
string $fontFile = null
): void;Execute a text
processWatermark()
protected function processWatermark(
AdapterInterface $image,
int $offsetX,
int $offsetY,
int $opacity
): void;Add Watermark
Image\Enum
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\Image\Enum
Constants
intAUTO = 4intHEIGHT = 3intHORIZONTAL = 11intINVERSE = 5intNONE = 1intPRECISE = 6intTENSILE = 7intVERTICAL = 12intWIDTH = 2Image\Exception
Class Source on GitHubExceptions thrown in Phalcon\Image will use this class
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\CompositeFailedPhalcon\Image\Exceptions\ExtensionNotLoadedPhalcon\Image\Exceptions\ImageLoadFailedPhalcon\Image\Exceptions\MissingDimensionsPhalcon\Image\Exceptions\MissingHeightPhalcon\Image\Exceptions\MissingWidthPhalcon\Image\Exceptions\ResizeFailedPhalcon\Image\Exceptions\ResourceTypeErrorPhalcon\Image\Exceptions\TextRenderingFailedPhalcon\Image\Exceptions\UnsupportedImageTypePhalcon\Image\Exceptions\VersionMismatch
Image\Exceptions\CompositeFailed
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\CompositeFailed
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\ExtensionNotLoaded
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\ExtensionNotLoaded
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct( string $extension );Image\Exceptions\ImageLoadFailed
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\ImageLoadFailed
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct( string $file );Image\Exceptions\MissingDimensions
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\MissingDimensions
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\MissingHeight
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\MissingHeight
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\MissingWidth
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\MissingWidth
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\ResizeFailed
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\ResizeFailed
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\ResourceTypeError
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\ResourceTypeError
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\TextRenderingFailed
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\TextRenderingFailed
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct();Image\Exceptions\UnsupportedImageType
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\UnsupportedImageType
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct( string $format = "" );Image\Exceptions\VersionMismatch
Class Source on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Image\ExceptionPhalcon\Image\Exceptions\VersionMismatch
Uses Phalcon\Image\Exception
Method Summary
Methods
__construct()
public function __construct( string $version );Image\ImageFactory
Class Source on GitHubFactory to create adapters for image manipulation
Phalcon\Factory\AbstractConfigFactoryPhalcon\Factory\AbstractFactoryPhalcon\Image\ImageFactory
Uses Phalcon\Config\ConfigInterface · Phalcon\Factory\AbstractFactory · Phalcon\Image\Adapter\AdapterInterface
Method Summary
public__construct( array $services = [] )ConstructorpublicAdapterInterfaceload( mixed $config )Factory to create an instance from a Config objectpublicAdapterInterfacenewInstance(string $name,string $file,int $width = null,int $height = null)Creates a new instanceprotectedstringgetExceptionClass()protectedarraygetServices()Returns the available adaptersMethods
__construct()
public function __construct( array $services = [] );Constructor
load()
public function load( mixed $config ): AdapterInterface;Factory to create an instance from a Config object
newInstance()
public function newInstance(
string $name,
string $file,
int $width = null,
int $height = null
): AdapterInterface;Creates a new instance
getExceptionClass()
protected function getExceptionClass(): string;getServices()
protected function getServices(): array;Returns the available adapters