Image
Table of Contents
Constants
- FORMAT_BMP = \IMAGETYPE_BMP
- FORMAT_GIF = \IMAGETYPE_GIF
- FORMAT_JPEG = \IMAGETYPE_JPEG
- FORMAT_PNG = \IMAGETYPE_PNG
- FORMAT_WEBP = \IMAGETYPE_WEBP
- RESIZE_EXACT = 2
- RESIZE_PROPORTIONAL = 1
- RESIZE_PROPORTIONAL_ALT = 0
Methods
- __construct() : mixed
- Image constructor.
- autoRotate() : bool
- Fixes wierd orientation (from EXIF).
- clear() : mixed
- Clears all resources associated to the image.
- drawWatermark() : bool
- Draws a text or image watermark on the image (depending on type).
- exceedsMaxSize() : bool
- Returns true if the image exceeds maximum dimensions in options.
- filter() : bool
- Applies a mask to the image (convolution).
- flipHorizontal() : bool
- Flips the image horizontally.
- flipVertical() : bool
- Flips the image vertically.
- getDimensions() : Rectangle
- Returns actual width and height in the Rectangle object.
- getExifData() : array<string|int, mixed>
- Returns EXIF data from the image.
- getHeight() : int
- Returns actual height of the image.
- getInfo() : Info|null
- Returns the image file info, including the image size.
- getWidth() : int
- Returns actual width of the image.
- load() : bool
- Reads the image data from the file.
- resize() : bool
- Resizes the image.
- rotate() : bool
- Rotates the image clockwise.
- save() : bool
- Saves the image to the current file.
- saveAs() : bool
- Saves the image to the specified file.
- setEngine() : mixed
- Sets image processing engine.
- setOrientation() : bool
- Sets the image orientation.
Constants
FORMAT_BMP
public
mixed
FORMAT_BMP
= \IMAGETYPE_BMP
FORMAT_GIF
public
mixed
FORMAT_GIF
= \IMAGETYPE_GIF
FORMAT_JPEG
public
mixed
FORMAT_JPEG
= \IMAGETYPE_JPEG
FORMAT_PNG
public
mixed
FORMAT_PNG
= \IMAGETYPE_PNG
FORMAT_WEBP
public
mixed
FORMAT_WEBP
= \IMAGETYPE_WEBP
RESIZE_EXACT
public
mixed
RESIZE_EXACT
= 2
RESIZE_PROPORTIONAL
public
mixed
RESIZE_PROPORTIONAL
= 1
RESIZE_PROPORTIONAL_ALT
public
mixed
RESIZE_PROPORTIONAL_ALT
= 0
Methods
__construct()
Image constructor.
public
__construct([string|null $file = null ]) : mixed
Parameters
- $file : string|null = null
-
Physical file name.
autoRotate()
Fixes wierd orientation (from EXIF).
public
autoRotate(int $orientation) : bool
Parameters
- $orientation : int
Return values
bool —True if it was fixed.
clear()
Clears all resources associated to the image.
public
clear() : mixed
drawWatermark()
Draws a text or image watermark on the image (depending on type).
public
drawWatermark(Watermark $watermark) : bool
Parameters
- $watermark : Watermark
Return values
boolexceedsMaxSize()
Returns true if the image exceeds maximum dimensions in options.
public
exceedsMaxSize() : bool
Return values
boolfilter()
Applies a mask to the image (convolution).
public
filter(Mask $mask) : bool
Parameters
- $mask : Mask
Return values
boolflipHorizontal()
Flips the image horizontally.
public
flipHorizontal() : bool
Return values
boolflipVertical()
Flips the image vertically.
public
flipVertical() : bool
Return values
boolgetDimensions()
Returns actual width and height in the Rectangle object.
public
getDimensions() : Rectangle
Return values
RectanglegetExifData()
Returns EXIF data from the image.
public
getExifData() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeight()
Returns actual height of the image.
public
getHeight() : int
Return values
intgetInfo()
Returns the image file info, including the image size.
public
getInfo([bool $flashEnabled = false ]) : Info|null
Parameters
- $flashEnabled : bool = false
Return values
Info|nullgetWidth()
Returns actual width of the image.
public
getWidth() : int
Return values
intload()
Reads the image data from the file.
public
load() : bool
Return values
boolresize()
Resizes the image.
public
resize(Rectangle $source, Rectangle $destination) : bool
Parameters
Return values
boolrotate()
Rotates the image clockwise.
public
rotate(float $angle[, Color|null $bgColor = null ]) : bool
Parameters
- $angle : float
- $bgColor : Color|null = null
Return values
boolsave()
Saves the image to the current file.
public
save([int $quality = 95 ]) : bool
Parameters
- $quality : int = 95
-
Percents, normalized to 95 on incorrect values.
Return values
boolsaveAs()
Saves the image to the specified file.
public
saveAs(string $file[, int $quality = 95 ][, int|null $format = null ]) : bool
Parameters
- $file : string
-
Physical file.
- $quality : int = 95
-
Percents, normalized to 95 on incorrect values.
- $format : int|null = null
-
One of the Image::FORMAT_* constants.
Return values
boolsetEngine()
Sets image processing engine.
public
setEngine(Engine $engine) : mixed
Parameters
- $engine : Engine
setOrientation()
Sets the image orientation.
public
setOrientation(mixed $orientation) : bool
Parameters
- $orientation : mixed