Method | Description | |
---|---|---|
crop ( integer $width, integer $height, integer $offestX, integer $offestY ) : Webiny\Component\Image\ImageInterface | Crop the image to the given dimensions. | |
getBinary ( array $options = [] ) : string | Get image as a binary string. | |
getFormat ( ) : string | Get the image mime-type format. | |
getInstance ( ) : mixed | This method returns the instance of the Image object from the bridged library. | |
getSize ( ) : 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 ) : Webiny\Component\Image\ImageInterface | Resize the image to given dimensions. | |
rotate ( integer $angle, null | string $bgColor = null ) : Webiny\Component\Image\ImageInterface | Rotate the image under the given $angle. | |
save ( |
Saves the current image to the given location. | |
setDestination ( |
Sets the image destination. | |
setFormat ( string $format ) | Sets image mime-type format. | |
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 crop ( integer $width, integer $height, integer $offestX, integer $offestY ) : Webiny\Component\Image\ImageInterface | ||
$width | integer | Width on the new image. |
$height | integer | Height of the new image. |
$offestX | integer | Crop start position on X axis. |
$offestY | integer | Crop start position on Y axis. |
return | Webiny\Component\Image\ImageInterface |
public getInstance ( ) : mixed | ||
return | mixed |
public getSize ( ) : ArrayObject | ||
return | ArrayObject |
public resize ( integer $width, integer $height, boolean $preserveAspectRatio = true ) : Webiny\Component\Image\ImageInterface | ||
$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. |
return | Webiny\Component\Image\ImageInterface |
public rotate ( integer $angle, null | string $bgColor = null ) : Webiny\Component\Image\ImageInterface | ||
$angle | integer | Angle in degrees how much to rotate the image. |
$bgColor | null | string | Optional parameter that fills the background with the defined color. Following formats are acceptable - "fff" - "ffffff" - array(255,255,255) |
return | Webiny\Component\Image\ImageInterface |
public setDestination ( |
||
$destination | Destination where to store the image. |
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) |