Image manipulations.
More...
Image manipulations.
Class to manipulate images. Some methods are based on https://dev.media-box.net/big/
◆ __construct()
Constructor, no parameters.
◆ close()
Close
Destroy image resource
◆ loadImage()
loadImage |
( |
string |
$filename | ) |
|
Load image
Loads an image content in memory and set $res
property.
- Parameters
-
string | $filename | Image file path |
References memoryAllocate().
◆ getW()
Image width
- Returns
- int Image width
Referenced by resize().
◆ getH()
Image height
- Returns
- int Image height
Referenced by resize().
◆ memoryAllocate()
memoryAllocate |
( |
int |
$width, |
|
|
int |
$height, |
|
|
int |
$bpp = 4 |
|
) |
| |
Allocate memory
- Parameters
-
int | $width | The width |
int | $height | The height |
int | $bpp | The bits per pixel |
- Exceptions
-
Referenced by loadImage(), and resize().
◆ output()
output |
( |
string |
$type = 'png' , |
|
|
?string |
$file = null , |
|
|
int |
$qual = 90 |
|
) |
| |
Image output
Returns image content in a file or as HTML output (with headers)
- Parameters
-
string | $type | Image type (png, jpg, webp or avif) |
string | null | $file | Output file. If null, output will be echoed in STDOUT |
int | $qual | JPEG image quality |
- Returns
- mixed
◆ resize()
resize |
( |
|
$width, |
|
|
|
$height, |
|
|
string |
$mode = 'ratio' , |
|
|
bool |
$expand = false |
|
) |
| |
Resize image
- Parameters
-
mixed | $width | Image width (px or percent) |
mixed | $height | Image height (px or percent) |
string | $mode | Crop mode (force, crop, ratio) |
boolean | $expand | Allow resize of image |
- Returns
- true
References getH(), getW(), and memoryAllocate().
◆ $res
◆ $memory_limit
The documentation for this class was generated from the following file: