Secciones

Abstract Class Phalcon\Image\Adapter\AbstractAdapter

Código fuente en GitHub

Namespace Phalcon\Image\Adapter   Uses Phalcon\Image\Enum, Phalcon\Image\Exception   Implements AdapterInterface

Todos los adaptadores de imagen deben usar esta clase

Propiedades

/**
 * @var string
 */
protected file;

/**
 * Image height
 *
 * @var int
 */
protected height;

/**
 * @var mixed|null
 */
protected image;

/**
 * Image mime type
 *
 * @var string
 */
protected mime;

/**
 * @var string
 */
protected realpath;

/**
 * Image type
 *
 * Driver dependent
 *
 * @var int
 */
protected type;

/**
 * Image width
 *
 * @var int
 */
protected width;

Métodos

public function background( string $color, int $opacity = int ): AdapterInterface;

Establece el color de fondo de una imagen

public function blur( int $radius ): AdapterInterface;

Desenfoca una imagen

public function crop( int $width, int $height, int $offsetX = null, int $offsetY = null ): AdapterInterface;

Recorta una imagen al tamaño dado

public function flip( int $direction ): AdapterInterface;

Da la vuelta a la imagen a lo largo del eje horizontal o vertical

public function getHeight(): int;
public function getImage();
public function getMime(): string;
public function getRealpath(): string;
public function getType(): int;
public function getWidth(): int;
public function mask( AdapterInterface $mask ): AdapterInterface;

Combina una imagen en otra

public function pixelate( int $amount ): AdapterInterface;

Pixela una imagen

public function reflection( int $height, int $opacity = int, bool $fadeIn = bool ): AdapterInterface;

Añade un reflejo a una imagen

public function render( string $extension = null, int $quality = int ): string;

Renderiza la imagen y devuelve la cadena binaria

public function resize( int $width = null, int $height = null, int $master = static-constant-access ): AdapterInterface;

Redimensiona la imagen al tamaño dado

public function rotate( int $degrees ): AdapterInterface;

Rota la imagen en la cantidad indicada

public function save( string $file = null, int $quality = int ): AdapterInterface;

Guarda la imagen

public function sharpen( int $amount ): AdapterInterface;

Ajusta la nitidez de la imagen en la cantidad indicada

public function text( string $text, mixed $offsetX = bool, mixed $offsetY = bool, int $opacity = int, string $color = string, int $size = int, string $fontFile = null ): AdapterInterface;

Añade un texto a un imagen con una opacidad especificada

public function watermark( AdapterInterface $watermark, int $offsetX = int, int $offsetY = int, int $opacity = int ): AdapterInterface;

Añade una marca de agua a una imagen con una opacidad especificada

protected function checkHighLow( int $value, int $min = int, int $max = int ): int;

Interface Phalcon\Image\Adapter\AdapterInterface

Código fuente en GitHub

Namespace Phalcon\Image\Adapter   Uses Phalcon\Image\Enum

Interface for Phalcon\Image\Adapter classes

Métodos

public function background( string $color, int $opacity = int ): AdapterInterface;

Add a background to an image

public function blur( int $radius ): AdapterInterface;

Blur an image

public function crop( int $width, int $height, int $offsetX = null, int $offsetY = null ): AdapterInterface;

Crop an image

public function flip( int $direction ): AdapterInterface;

Flip an image

public function mask( AdapterInterface $mask ): AdapterInterface;

Add a mask to an image

public function pixelate( int $amount ): AdapterInterface;

Pixelate an image

public function reflection( int $height, int $opacity = int, bool $fadeIn = bool ): AdapterInterface;

Reflect an image

public function render( string $extension = null, int $quality = int ): string;

Render an image

public function resize( int $width = null, int $height = null, int $master = static-constant-access ): AdapterInterface;

Resize an image

public function rotate( int $degrees ): AdapterInterface;

Rotate an image

public function save( string $file = null, int $quality = int ): AdapterInterface;

Save an image

public function sharpen( int $amount ): AdapterInterface;

Sharpen an image

public function text( string $text, int $offsetX = int, int $offsetY = int, int $opacity = int, string $color = string, int $size = int, string $fontFile = null ): AdapterInterface;

Adds text on an image

public function watermark( AdapterInterface $watermark, int $offsetX = int, int $offsetY = int, int $opacity = int ): AdapterInterface;

Add a watermark on an image

Class Phalcon\Image\Adapter\Gd

Código fuente en GitHub

Namespace Phalcon\Image\Adapter   Uses Phalcon\Image\Enum, Phalcon\Image\Exception   Extends AbstractAdapter

Este fichero es parte del Framework Phalcon.

(c) Phalcon Team [email protected]

Para obtener toda la información sobre derechos de autor y licencias, por favor vea el archivo LICENSE.txt que se distribuyó con este código fuente.

Métodos

public function __construct( string $file, int $width = null, int $height = null );
public function __destruct();

Destructor

public function getVersion(): string;
protected function processBackground( int $red, int $green, int $blue, int $opacity ): void;
protected function processBlur( int $radius ): void;
protected function processCreate( int $width, int $height );
protected function processCrop( int $width, int $height, int $offsetX, int $offsetY ): void;
protected function processFlip( int $direction ): void;
protected function processMask( AdapterInterface $mask );
protected function processPixelate( int $amount ): void;
protected function processReflection( int $height, int $opacity, bool $fadeIn ): void;
protected function processRender( string $extension, int $quality );
protected function processResize( int $width, int $height ): void;
protected function processRotate( int $degrees ): void;
protected function processSave( string $file, int $quality ): bool;
protected function processSharpen( int $amount ): void;
protected function processText( string $text, mixed $offsetX, mixed $offsetY, int $opacity, int $red, int $green, int $blue, int $size, string $fontFile = null ): void;
protected function processWatermark( AdapterInterface $watermark, int $offsetX, int $offsetY, int $opacity ): void;

Class Phalcon\Image\Adapter\Imagick

Código fuente en GitHub

Namespace Phalcon\Image\Adapter   Uses Imagick, ImagickDraw, ImagickDrawException, ImagickException, ImagickPixel, ImagickPixelException, Phalcon\Image\Enum, Phalcon\Image\Exception   Extends AbstractAdapter

Phalcon\Image\Adapter\Imagick

Soporte para manipulación de imágenes. 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";
}

Propiedades

/**
 * @var int
 */
protected version = 0;

Métodos

public function __construct( string $file, int $width = null, int $height = null );

Constructor

public function __destruct();

Destruye la imagen cargada para liberar recursos.

public function liquidRescale( int $width, int $height, int $deltaX = int, int $rigidity = int ): AbstractAdapter;

Este método escala las imágenes usando el método de reescalado líquido. Solo para soporte Imagick

public function setResourceLimit( int $type, int $limit ): void;

Establece los limites para un recurso particular en megabytes

protected function processBackground( int $red, int $green, int $blue, int $opacity ): void;

Ejecuta un fondo.

protected function processBlur( int $radius ): void;

Desenfoca una imagen

protected function processCrop( int $width, int $height, int $offsetX, int $offsetY ): void;

Ejecuta un recorte.

protected function processFlip( int $direction ): void;

Ejecuta un giro.

protected function processMask( AdapterInterface $image ): void;

Combina una imagen en otra

protected function processPixelate( int $amount ): void;

Pixela una imagen

protected function processReflection( int $height, int $opacity, bool $fadeIn ): void;

Ejecuta un reflejo.

protected function processRender( string $extension, int $quality ): string;

Ejecuta un renderizado.

protected function processResize( int $width, int $height ): void;

Ejecuta un cambio de tamaño.

protected function processRotate( int $degrees ): void;

Ejecuta una rotación.

protected function processSave( string $file, int $quality ): void;

Ejecuta un guardado.

protected function processSharpen( int $amount ): void;

Ejecuta un ajuste de nitidez.

protected function processText( string $text, mixed $offsetX, mixed $offsetY, int $opacity, int $red, int $green, int $blue, int $size, string $fontFile = null ): void;

Ejecuta un texto

protected function processWatermark( AdapterInterface $image, int $offsetX, int $offsetY, int $opacity ): void;

Add Watermark

Class Phalcon\Image\Enum

Código fuente en GitHub

Namespace Phalcon\Image

Este fichero es parte del Framework Phalcon.

(c) Phalcon Team [email protected]

Para obtener toda la información sobre derechos de autor y licencias, por favor vea el archivo LICENSE.txt que se distribuyó con este código fuente.

Constantes

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

Código fuente en GitHub

Namespace Phalcon\Image   Extends \Exception

Exceptions thrown in Phalcon\Image will use this class

Class Phalcon\Image\ImageFactory

Código fuente en GitHub

Namespace Phalcon\Image   Uses Phalcon\Factory\AbstractFactory, Phalcon\Image\Adapter\AdapterInterface   Extends AbstractFactory

Métodos

public function __construct( array $services = [] );

Constructor

public function load( mixed $config ): AdapterInterface;

Factoría para crear una instancia desde un objeto Config

public function newInstance( string $name, string $file, int $width = null, int $height = null ): AdapterInterface;

Crea una nueva instancia

protected function getExceptionClass(): string;
protected function getServices(): array;

Devuelve los adaptadores disponibles