Image
class Image
Image manipulation class.
Constants
RESIZE_IGNORE |
Resizing constraint. |
RESIZE_AUTO |
Resizing constraint. |
RESIZE_WIDTH |
Resizing constraint. |
RESIZE_HEIGHT |
Resizing constraint. |
WATERMARK_TOP_LEFT |
Watermark position. |
WATERMARK_TOP_RIGHT |
Watermark position. |
WATERMARK_BOTTOM_LEFT |
Watermark position. |
WATERMARK_BOTTOM_RIGHT |
Watermark position. |
WATERMARK_CENTER |
Watermark position. |
FLIP_VERTICAL |
Flip direction. |
FLIP_HORIZONTAL |
Flip direction. |
Properties
protected ProcessorInterface | $processor | Processor instance. | |
protected string | $image | Path to image file. |
Methods
Makes sure that the quality is between 1 and 100.
Creates a snapshot of the image.
Retstores the image snapshot.
Returns the image width in pixels.
Returns the image height in pixels.
Returns an array containing the image dimensions in pixels.
Resizes the image to the chosen size.
Adds a watermark to the image.
Adjust image brightness.
Sharpens the image.
Returns a string containing the image.
Saves image to file.
Details
at line 122
__construct(string $image, ProcessorInterface $processor)
Constructor.
at line 146
protected int
normalizeImageQuality(int $quality)
Makes sure that the quality is between 1 and 100.
at line 154
snapshot()
Creates a snapshot of the image.
at line 162
restore()
Retstores the image snapshot.
at line 172
int
getWidth()
Returns the image width in pixels.
at line 182
int
getHeight()
Returns the image height in pixels.
at line 192
array
getDimensions()
Returns an array containing the image dimensions in pixels.
at line 203
Image
rotate(int $degrees)
Rotates the image using the given angle in degrees.
at line 218
Image
resize(int $width, int $height = null, int $aspectRatio = Image::RESIZE_IGNORE)
Resizes the image to the chosen size.
at line 234
Image
crop(int $width, int $height, int $x, int $y)
Crops the image.
at line 247
Image
flip(int $direction = Image::FLIP_HORIZONTAL)
Flips the image.
at line 262
Image
watermark(string $file, int $position = Image::WATERMARK_TOP_LEFT, int $opacity = 100)
Adds a watermark to the image.
at line 288
Image
brightness(int $level = 50)
Adjust image brightness.
at line 306
Image
greyscale()
Converts image to greyscale.
at line 318
Image
sepia()
Converts image to sepia.
at line 330
Image
bitonal()
Converts image to bitonal.
at line 343
Image
colorize(string $color)
Colorizes the image.
at line 353
sharpen()
Sharpens the image.
at line 366
Image
pixelate(int $pixelSize = 10)
Pixelates the image.
at line 378
Image
negate()
Negates the image.
at line 392
Image
border(string $color = '#000', int $thickness = 5)
Adds a border to the image.
at line 406
string
getImageBlob(string $type = null, int $quality = 95)
Returns a string containing the image.
at line 417
save(string $file = null, int $quality = 95)
Saves image to file.