Abstract Class Phalcon\Image\Adapter\AbstractAdapter
Source on GitHub
Namespace |
Phalcon\Image\Adapter |
|
Uses |
Phalcon\Image\Enum, Phalcon\Image\Exception |
|
Implements |
AdapterInterface |
Phalcon\Image\Adapter
All image adapters must use this class
Properties
//
protected static checked = false;
//
protected file;
/**
* Image height
*
* @var int
*/
protected height;
//
protected image;
/**
* Image mime type
*
* @var string
*/
protected mime;
//
protected realpath;
/**
* Image type
*
* Driver dependent
*
* @var int
*/
protected type;
/**
* Image width
*
* @var int
*/
protected width;
Methods
public function background( string $color, int $opacity = int ): AdapterInterface;
Set the background color of an image
public function blur( int $radius ): AdapterInterface;
Blur image
public function crop( int $width, int $height, int $offsetX = null, int $offsetY = null ): AdapterInterface;
Crop an image to the given size
public function flip( int $direction ): AdapterInterface;
Flip the image along the horizontal or vertical axis
public function getHeight(): int
public function getImage()
public function getMime(): string
public function getRealpath()
public function getType(): int
public function getWidth(): int
public function liquidRescale( int $width, int $height, int $deltaX = int, int $rigidity = int ): AbstractAdapter;
This method scales the images using liquid rescaling method. Only support Imagick
public function mask( AdapterInterface $watermark ): AdapterInterface;
Composite one image onto another
public function pixelate( int $amount ): AdapterInterface;
Pixelate image
public function reflection( int $height, int $opacity = int, bool $fadeIn = bool ): AdapterInterface;
Add a reflection to an image
public function render( string $ext = null, int $quality = int ): string;
Render the image and return the binary string
public function resize( int $width = null, int $height = null, int $master = static-constant-access ): AdapterInterface;
Resize the image to the given size
public function rotate( int $degrees ): AdapterInterface;
Rotate the image by a given amount
public function save( string $file = null, int $quality = int ): AdapterInterface;
Save the image
public function sharpen( int $amount ): AdapterInterface;
Sharpen the image by a given amount
public function text( string $text, mixed $offsetX = bool, mixed $offsetY = bool, int $opacity = int, string $color = string, int $size = int, string $fontfile = null ): AdapterInterface;
Add a text to an image with a specified opacity
public function watermark( AdapterInterface $watermark, int $offsetX = int, int $offsetY = int, int $opacity = int ): AdapterInterface;
Add a watermark to an image with the specified opacity
Interface Phalcon\Image\Adapter\AdapterInterface
Source on GitHub
Namespace |
Phalcon\Image\Adapter |
|
Uses |
Phalcon\Image\Enum |
This 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.
Methods
public function background( string $color, int $opacity = int ): AdapterInterface;
public function blur( int $radius ): AdapterInterface;
public function crop( int $width, int $height, int $offsetX = null, int $offsetY = null ): AdapterInterface;
public function flip( int $direction ): AdapterInterface;
public function mask( AdapterInterface $watermark ): AdapterInterface;
public function pixelate( int $amount ): AdapterInterface;
public function reflection( int $height, int $opacity = int, bool $fadeIn = bool ): AdapterInterface;
public function render( string $ext = null, int $quality = int ): string;
public function resize( int $width = null, int $height = null, int $master = static-constant-access ): AdapterInterface;
public function rotate( int $degrees ): AdapterInterface;
public function save( string $file = null, int $quality = int ): AdapterInterface;
public function sharpen( int $amount ): AdapterInterface;
public function text( string $text, int $offsetX = int, int $offsetY = int, int $opacity = int, string $color = string, int $size = int, string $fontfile = null ): AdapterInterface;
public function watermark( AdapterInterface $watermark, int $offsetX = int, int $offsetY = int, int $opacity = int ): AdapterInterface;
Class Phalcon\Image\Adapter\Gd
Source on GitHub
Namespace |
Phalcon\Image\Adapter |
|
Uses |
Phalcon\Image\Enum, Phalcon\Image\Exception |
|
Extends |
AbstractAdapter |
This 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.
Properties
//
protected static checked = false;
Methods
public function __construct( string $file, int $width = null, int $height = null );
public function __destruct();
public static function check(): bool;
public static function getVersion(): string;
protected function processBackground( int $r, int $g, int $b, int $opacity );
protected function processBlur( int $radius );
protected function processCreate( int $width, int $height );
protected function processCrop( int $width, int $height, int $offsetX, int $offsetY );
protected function processFlip( int $direction );
protected function processMask( AdapterInterface $mask );
protected function processPixelate( int $amount );
protected function processReflection( int $height, int $opacity, bool $fadeIn );
protected function processRender( string $ext, int $quality );
protected function processResize( int $width, int $height );
protected function processRotate( int $degrees );
protected function processSave( string $file, int $quality );
protected function processSharpen( int $amount );
protected function processText( string $text, int $offsetX, int $offsetY, int $opacity, int $r, int $g, int $b, int $size, string $fontfile );
protected function processWatermark( AdapterInterface $watermark, int $offsetX, int $offsetY, int $opacity );
Class Phalcon\Image\Adapter\Imagick
Source on GitHub
Namespace |
Phalcon\Image\Adapter |
|
Uses |
Phalcon\Image\Enum, Phalcon\Image\Exception |
|
Extends |
AbstractAdapter |
Phalcon\Image\Adapter\Imagick
Image manipulation support. Allows images to be resized, cropped, etc.
$image = new \Phalcon\Image\Adapter\Imagick("upload/test.jpg");
$image->resize(200, 200)->rotate(90)->crop(100, 100);
if ($image->save()) {
echo "success";
}
Properties
//
protected static checked = false;
//
protected static version = 0;
Methods
public function __construct( string $file, int $width = null, int $height = null );
\Phalcon\Image\Adapter\Imagick constructor
public function __destruct();
Destroys the loaded image to free up resources.
public static function check(): bool;
Checks if Imagick is enabled
public function getInternalImInstance(): \Imagick;
Get instance
public function setResourceLimit( int $type, int $limit );
Sets the limit for a particular resource in megabytes
@link https://php.net/manual/ru/imagick.constants.php#imagick.constants.resourcetypes
protected function processBackground( int $r, int $g, int $b, int $opacity );
Execute a background.
protected function processBlur( int $radius );
Blur image
protected function processCrop( int $width, int $height, int $offsetX, int $offsetY );
Execute a crop.
protected function processFlip( int $direction );
Execute a flip.
protected function processLiquidRescale( int $width, int $height, int $deltaX, int $rigidity );
This method scales the images using liquid rescaling method. Only support Imagick
protected function processMask( AdapterInterface $image );
Composite one image onto another
protected function processPixelate( int $amount );
Pixelate image
protected function processReflection( int $height, int $opacity, bool $fadeIn );
Execute a reflection.
protected function processRender( string $extension, int $quality ): string;
Execute a render.
protected function processResize( int $width, int $height );
Execute a resize.
protected function processRotate( int $degrees );
Execute a rotation.
protected function processSave( string $file, int $quality );
Execute a save.
protected function processSharpen( int $amount );
Execute a sharpen.
protected function processText( string $text, mixed $offsetX, mixed $offsetY, int $opacity, int $r, int $g, int $b, int $size, string $fontfile );
Execute a text
protected function processWatermark( AdapterInterface $image, int $offsetX, int $offsetY, int $opacity );
Execute a watermarking.
Class Phalcon\Image\Enum
Source on GitHub
This 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.
Constants
const AUTO = 4;
const HEIGHT = 3;
const HORIZONTAL = 11;
const INVERSE = 5;
const NONE = 1;
const PRECISE = 6;
const TENSILE = 7;
const VERTICAL = 12;
const WIDTH = 2;
Class Phalcon\Image\Exception
Source on GitHub
Namespace |
Phalcon\Image |
|
Extends |
\Phalcon\Exception |
This 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.
Class Phalcon\Image\ImageFactory
Source on GitHub
Namespace |
Phalcon\Image |
|
Uses |
Phalcon\Config, Phalcon\Factory\AbstractFactory, Phalcon\Helper\Arr, Phalcon\Image\Adapter\AdapterInterface |
|
Extends |
AbstractFactory |
Phalcon\Image/ImageFactory
Methods
public function __construct( array $services = [] );
TagFactory constructor.
public function load( mixed $config ): AdapterInterface;
Factory to create an instance from a Config object
public function newInstance( string $name, string $file, int $width = null, int $height = null ): AdapterInterface;
Creates a new instance
protected function getAdapters(): array;