GD
extends ImageDriver
in package
GD Image Driver.
Table of Contents
Properties
- $blank_png : resource|GdImage|false
- Reference to the current image
- $blank_png_height : int
- $blank_png_width : int
- $errors : array<string|int, string>
- $image : array<string|int, mixed>
- $tmp_image : resource|GdImage|false
- Reference to the temporary processing image
Methods
- __construct() : mixed
- addText() : mixed
- crop() : bool
- Crop an image. Valid properties are: width, height, top, left.
- execute() : bool
- Executes a set of actions, defined in pairs.
- flip() : bool
- Flip an image. Valid directions are horizontal and vertical.
- process() : bool
- Process an image with a set of actions.
- resize() : bool
- Resize an image. Valid properties are: width, height, and master.
- rotate() : bool
- Rotate an image. Valid amounts are -180 to 180.
- sharpen() : bool
- Sharpen and image. Valid amounts are 1 to 100.
- imagecreatetransparent() : GdImage|resource
- Returns an image with a transparent background. Used for rotating to prevent unfilled backgrounds.
- properties() : array<string|int, mixed>
- Return the current width and height of the temporary image. This is mainly needed for sanitizing the geometry.
- sanitizeGeometry() : void
- Sanitize and normalize a geometry array based on the temporary image width and height. Valid properties are: width, height, top, left.
Properties
$blank_png
Reference to the current image
protected
static resource|GdImage|false
$blank_png
$blank_png_height
protected
static int
$blank_png_height
Width of the blank PNG
$blank_png_width
protected
static int
$blank_png_width
Width of the blank PNG
$errors
protected
array<string|int, string>
$errors
= array()
Processing errors
$image
protected
array<string|int, mixed>
$image
$tmp_image
Reference to the temporary processing image
protected
resource|GdImage|false
$tmp_image
Methods
__construct()
public
__construct() : mixed
addText()
public
addText(mixed $text) : mixed
Parameters
- $text : mixed
crop()
Crop an image. Valid properties are: width, height, top, left.
public
crop(mixed $properties) : bool
Parameters
- $properties : mixed
-
New properties
Return values
boolexecute()
Executes a set of actions, defined in pairs.
public
execute(array<string|int, mixed> $actions) : bool
Parameters
- $actions : array<string|int, mixed>
-
Actions
Return values
boolflip()
Flip an image. Valid directions are horizontal and vertical.
public
flip(mixed $direction) : bool
Parameters
- $direction : mixed
-
Direction to flip
Return values
boolprocess()
Process an image with a set of actions.
public
process(mixed $image, array<string|int, mixed> $actions, string $dir, string $file[, bool $render = false ]) : bool
Parameters
- $image : mixed
-
Image filename
- $actions : array<string|int, mixed>
- $dir : string
- $file : string
- $render : bool = false
Return values
boolresize()
Resize an image. Valid properties are: width, height, and master.
public
resize(mixed $properties) : bool
Parameters
- $properties : mixed
-
New properties
Return values
boolrotate()
Rotate an image. Valid amounts are -180 to 180.
public
rotate(mixed $amount) : bool
Parameters
- $amount : mixed
-
Amount to rotate
Return values
boolsharpen()
Sharpen and image. Valid amounts are 1 to 100.
public
sharpen(mixed $amount) : bool
Parameters
- $amount : mixed
-
Amount to sharpen
Return values
boolimagecreatetransparent()
Returns an image with a transparent background. Used for rotating to prevent unfilled backgrounds.
protected
imagecreatetransparent(int $width, int $height) : GdImage|resource
Parameters
- $width : int
-
Image width
- $height : int
-
Image height
Return values
GdImage|resourceproperties()
Return the current width and height of the temporary image. This is mainly needed for sanitizing the geometry.
protected
properties() : array<string|int, mixed>
Return values
array<string|int, mixed> —width, height
sanitizeGeometry()
Sanitize and normalize a geometry array based on the temporary image width and height. Valid properties are: width, height, top, left.
protected
sanitizeGeometry(array<string|int, mixed> &$geometry) : void
Parameters
- $geometry : array<string|int, mixed>
-
Geometry properties