Editor
class Editor implements EditorInterface
GD Editor class. Uses the PHP GD 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.
Convert alpha value of 0 - 1 to GD compatible alpha value of 0 - 127 where 0 is opaque and 127 is transparent
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 31
                            EditorInterface
    apply(ImageInterface $image, FilterInterface $filter)
        
    
    Apply a filter to the image. See Filters section for a list of available filters.
        at line         line 57
                            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 152
                            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 195
                            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 256
                            EditorInterface
    draw(ImageInterface $image, DrawingObjectInterface $drawingObject)
        
    
    Draw a DrawingObject on the image. See Drawing Objects section.
        at line         line 277
                            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 338
                            EditorInterface
    fill(ImageInterface $image, Color $color, int $x, int $y)
        
    
    Fill entire image with color.
        at line         line 361
                            EditorInterface
    flatten(ImageInterface $image)
        
    
    Flatten if animated GIF. Do nothing otherwise.
        at line         line 392
                            EditorInterface
    flip(ImageInterface $image, string $mode)
        
    
    Flip or mirrors the image.
        at line         line 405
                            EditorInterface
    free(ImageInterface $image)
        
    
    Free the image clearing resources associated with it.
        at line         line 418
                static            int
    gdAlpha(float $alpha)
        
    
    Convert alpha value of 0 - 1 to GD compatible alpha value of 0 - 127 where 0 is opaque and 127 is transparent
        at line         line 431
                            bool
    isAvailable()
        
    
    Checks if the editor is available on the current PHP install.
        at line         line 456
                            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.
Warning: This function loops thru each pixel manually which can be slow. Use sparingly.
        at line         line 499
                            EditorInterface
    open(ImageInterface $image, string $imageFile)
        
    
    Open an image file and assign Image to first parameter.
        at line         line 515
                            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 555
                            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 571
                            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 594
                            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 618
                            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 649
                            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 681
                            EditorInterface
    rotate(ImageInterface $image, int $angle, Color|null $color = null)
        
    
    Rotate an image counter-clockwise.
        at line         line 717
                            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 780
                            EditorInterface
    text(ImageInterface $image, string $text, int $size = 12, int $x, int $y, Color $color = null, string $font = '', int $angle)
        
    
    Write text to image.