Editor
class Editor implements EditorInterface
Imagick Editor class. Uses the PHP Imagick library.
Methods
Apply a filter to the image. See Filters section for a list of available filters.
Blend two images together with the first image as the base and the second image on top. Supports several blend modes.
Compare two images and returns a hamming distance. A value of 0 indicates a likely similar picture. A value between 1 and 10 is potentially a variation. A value greater than 10 is likely a different image.
Crop the image to the given dimension and position.
Draw a DrawingObject on the image. See Drawing Objects section.
Compare if two images are equal. It will compare if the two images are of the same width and height. If the dimensions differ, it will return false. If the dimensions are equal, it will loop through each pixels. If one of the pixel don't match, it will return false. The pixels are compared using their RGB (Red, Green, Blue) values.
Checks if the editor is available on the current PHP install.
Sets the image to the specified opacity level where 1.0 is fully opaque and 0.0 is fully transparent.
Open an image file and assign Image to first parameter.
Wrapper function for the resizeXXX family of functions. Resize image given width, height and mode.
Resize image to exact dimensions ignoring aspect ratio. Useful if you want to force exact width and height.
Resize image to exact height. Width is auto calculated. Useful for creating row of images with the same height.
Resize image to exact width. Height is auto calculated. Useful for creating column of images with the same width.
Resize image to fill all the space in the given dimension. Excess parts are cropped.
Resize image to fit inside the given dimension. No part of the image is lost.
Rotate an image counter-clockwise.
Save the image to an image format.
Write text to image.
Details
at line line 30
EditorInterface
apply(ImageInterface $image, FilterInterface $filter)
Apply a filter to the image. See Filters section for a list of available filters.
at line line 56
EditorInterface
blend(ImageInterface $image1, ImageInterface $image2, string $type = 'normal', float $opacity = 1.0, string $position = 'top-left', int $offsetX, int $offsetY)
Blend two images together with the first image as the base and the second image on top. Supports several blend modes.
at line line 118
int
compare(string|ImageInterface $image1, string|ImageInterface $image2)
Compare two images and returns a hamming distance. A value of 0 indicates a likely similar picture. A value between 1 and 10 is potentially a variation. A value greater than 10 is likely a different image.
at line line 161
EditorInterface
crop(ImageInterface $image, int $cropWidth, int $cropHeight, string $position = 'center', int $offsetX, int $offsetY)
Crop the image to the given dimension and position.
at line line 195
EditorInterface
draw(ImageInterface $image, DrawingObjectInterface $drawingObject)
Draw a DrawingObject on the image. See Drawing Objects section.
at line line 216
bool
equal(string|ImageInterface $image1, string|ImageInterface $image2)
Compare if two images are equal. It will compare if the two images are of the same width and height. If the dimensions differ, it will return false. If the dimensions are equal, it will loop through each pixels. If one of the pixel don't match, it will return false. The pixels are compared using their RGB (Red, Green, Blue) values.
at line line 275
EditorInterface
fill(ImageInterface $image, Color $color, int $x, int $y)
Fill entire image with color.
at line line 295
EditorInterface
flatten(ImageInterface $image)
Flatten if animated GIF. Do nothing otherwise.
at line line 320
EditorInterface
flip(ImageInterface $image, string $mode)
Flip or mirrors the image.
at line line 338
EditorInterface
free(ImageInterface $image)
Free the image clearing resources associated with it.
at line line 349
bool
isAvailable()
Checks if the editor is available on the current PHP install.
at line line 373
EditorInterface
opacity(ImageInterface $image, float $opacity)
Sets the image to the specified opacity level where 1.0 is fully opaque and 0.0 is fully transparent.
at line line 397
EditorInterface
open(ImageInterface $image, string $imageFile)
Open an image file and assign Image to first parameter.
at line line 413
EditorInterface
resize(ImageInterface $image, int $newWidth, int $newHeight, string $mode = 'fit')
Wrapper function for the resizeXXX family of functions. Resize image given width, height and mode.
at line line 453
EditorInterface
resizeExact(ImageInterface $image, int $newWidth, int $newHeight)
Resize image to exact dimensions ignoring aspect ratio. Useful if you want to force exact width and height.
at line line 469
EditorInterface
resizeExactHeight(ImageInterface $image, int $newHeight)
Resize image to exact height. Width is auto calculated. Useful for creating row of images with the same height.
at line line 492
EditorInterface
resizeExactWidth(ImageInterface $image, int $newWidth)
Resize image to exact width. Height is auto calculated. Useful for creating column of images with the same width.
at line line 516
EditorInterface
resizeFill(ImageInterface $image, int $newWidth, int $newHeight)
Resize image to fill all the space in the given dimension. Excess parts are cropped.
at line line 547
EditorInterface
resizeFit(ImageInterface $image, int $newWidth, int $newHeight)
Resize image to fit inside the given dimension. No part of the image is lost.
at line line 578
EditorInterface
rotate(ImageInterface $image, int $angle, Color|null $color = null)
Rotate an image counter-clockwise.
at line line 606
EditorInterface
save(ImageInterface $image, string $file, null|string $type = null, null|string $quality = null, bool $interlace = false, int $permission = 493)
Save the image to an image format.
at line line 668
EditorInterface
text(ImageInterface $image, string $text, int $size = 12, int $x, int $y, Color $color = null, string $font = '', int $angle)
Write text to image.