GD
class GD implements ProcessorInterface
GD processor.
Traits
Properties
protected resource | $image | Image resource. | |
protected resource | $snapshot | Image resource. | |
protected array | $imageInfo | Image info. | |
protected bool | $hasFilters | Do we have the imagefilter function? |
Methods
Calculates new image dimensions.
Constructor.
Destructor.
Collects information about the image.
Creates an image resource that we can work with.
Converts HEX value to an RGB array.
Opens the image we want to work with.
Creates a snapshot of the image resource.
Restores an image snapshot.
Returns the image width in pixels.
Returns the image height in pixels.
Returns an array containing the image dimensions in pixels.
Rotates the image using the given angle in degrees.
Resizes the image to the chosen size.
Crops the image.
Flips the image.
Adds a watermark to the image.
Adjust image brightness.
Converts image to greyscale.
Converts image to sepia.
Converts image to bitonal.
Colorize the image.
Sharpens the image.
Pixelates the image.
Negates the image.
Adds a border to the image.
Returns a string containing the image.
Saves image to file.
Details
in CalculateNewDimensionsTrait at line 32
protected array
calculateNewDimensions(int $width, int $height, int $oldWidth, int $oldHeight, int $aspectRatio)
Calculates new image dimensions.
at line 103
__construct()
Constructor.
at line 111
__destruct()
Destructor.
at line 130
protected array
getImageInfo(string $file)
Collects information about the image.
at line 149
protected resource
createImageResource(string $image, array $imageInfo)
Creates an image resource that we can work with.
at line 170
protected array
hexToRgb(string $hex)
Converts HEX value to an RGB array.
at line 198
open(string $image)
Opens the image we want to work with.
at line 208
snapshot()
Creates a snapshot of the image resource.
at line 221
restore()
Restores an image snapshot.
at line 236
int
getWidth()
Returns the image width in pixels.
at line 244
int
getHeight()
Returns the image height in pixels.
at line 252
array
getDimensions()
Returns an array containing the image dimensions in pixels.
at line 260
rotate(int $degrees)
Rotates the image using the given angle in degrees.
at line 288
resize(int $width, int $height = null, int $aspectRatio = Image::RESIZE_IGNORE)
Resizes the image to the chosen size.
at line 313
crop(int $width, int $height, int $x, int $y)
Crops the image.
at line 336
flip(int $direction = Image::FLIP_HORIZONTAL)
Flips the image.
at line 376
watermark(string $file, int $position = Image::WATERMARK_TOP_LEFT, int $opacity = 100)
Adds a watermark to the image.
at line 431
brightness(int $level = 50)
Adjust image brightness.
at line 475
greyscale()
Converts image to greyscale.
at line 522
sepia()
Converts image to sepia.
at line 561
bitonal()
Converts image to bitonal.
at line 603
colorize(string $color)
Colorize the image.
at line 649
sharpen()
Sharpens the image.
at line 661
pixelate(int $pixelSize = 10)
Pixelates the image.
at line 681
negate()
Negates the image.
at line 713
border(string $color = '#000', int $thickness = 5)
Adds a border to the image.
at line 742
string
getImageBlob(string $type = null, int $quality = 95)
Returns a string containing the image.
at line 778
save(string $file, int $quality = 95)
Saves image to file.