Метод | Описание | |
---|---|---|
__construct ( Imagine\Image\ImageInterface $image ) | Base constructor. | |
crop ( integer $width, integer $height, integer $offestX, integer $offestY ) | Crop the image to the given dimensions. | |
getBinary ( array $options = [] ) : string | Get image as a binary string. | |
getInstance ( ) : mixed | This method returns the instance of the Image object from the bridged library. | |
getSize ( ) : Webiny\Component\Image\ArrayObject | Returns the width and height of the image in pixels. | |
paste ( Webiny\Component\Image\ImageInterface $image, integer $offsetX, integer $offsetY ) | Paste another image into this one a the specified dimension. | |
resize ( integer $width, integer $height, boolean $preserveAspectRatio = true ) | Resize the image to given dimensions. | |
rotate ( integer $angle, null | string $bgColor = null ) | Rotate the image under the given $angle. | |
show ( ) : string | Output the image into the browser. | |
thumbnail ( integer $width, integer $height, boolean | string $cropOrPad = false, null | string $padColor = null ) | This is a method that combines resize, crop and paste methods in order to generate a thumbnail from the given image. |
public __construct ( Imagine\Image\ImageInterface $image ) | ||
$image | Imagine\Image\ImageInterface |
public getInstance ( ) : mixed | ||
Результат | mixed |
public getSize ( ) : Webiny\Component\Image\ArrayObject | ||
Результат | Webiny\Component\Image\ArrayObject |
public resize ( integer $width, integer $height, boolean $preserveAspectRatio = true ) | ||
$width | integer | Width of the new image. |
$height | integer | Height of the new image. |
$preserveAspectRatio | boolean | Do you wish to preserve the aspect ration while resizing. Default is true. NOTE: If you preserve the aspect ratio, the output image might not match the defined width and height. |
public thumbnail ( integer $width, integer $height, boolean | string $cropOrPad = false, null | string $padColor = null ) | ||
$width | integer | Thumb width. |
$height | integer | Thumb height. |
$cropOrPad | boolean | string | If you set this to 'crop' the method will first resize the image to preserve the aspect ratio and then it will crop the extra pixels to fit the defined width and height. If you set this to 'pad' the method will first do the resize and than it wil create a blank image that has the size of defined width and height and fill it with $padColor, then it will paste the resized image in the center of the new image. |
$padColor | null | string | Parameter that fills the background with the defined color. Following formats are acceptable - "fff" - "ffffff" - array(255,255,255) |