Image manipulation service.
More...
|
| getFileFormat ($filename, $params) |
| Determine the image file format, this is needed for correct resizing. More...
|
|
Image manipulation service.
- Since
- 2.3
Definition at line 21 of file ImageService.php.
Elgg\ImageService::fixOrientation |
( |
|
$filename | ) |
|
If needed the image will be rotated based on orientation information.
- Parameters
-
string | $filename | Path to image |
- Returns
- bool
Definition at line 146 of file ImageService.php.
Elgg\ImageService::getFileFormat |
( |
|
$filename, |
|
|
|
$params |
|
) |
| |
|
protected |
Determine the image file format, this is needed for correct resizing.
- Parameters
-
string | $filename | path to the file |
array | $params | array of resizing params (can contain 'format' to set save format) |
- See also
- https://github.com/Elgg/Elgg/issues/10686
- Returns
- void|string
Definition at line 271 of file ImageService.php.
Elgg\ImageService::hasWebPSupport |
( |
| ) |
|
Checks if imagine has WebP support.
- Returns
- bool
Definition at line 302 of file ImageService.php.
Elgg\ImageService::normalizeResizeParameters |
( |
string |
$source, |
|
|
array |
$params = [] |
|
) |
| |
Calculate the parameters for resizing an image.
- Parameters
-
string | $source | The source location of the image to validate the parameters for |
array | $params | Resize parameters
- 'w' maximum width of the resized image
- 'h' maximum height of the resized image
- 'upscale' allow upscaling
- 'square' constrain to a square
- 'x1', 'y1', 'x2', 'y2' cropping coordinates
|
- Returns
- array
- Exceptions
-
InvalidArgumentException | |
RangeException | |
Definition at line 183 of file ImageService.php.
Elgg\ImageService::resize |
( |
string |
$source, |
|
|
string |
$destination = null , |
|
|
array |
$params = [] |
|
) |
| |
Crop and resize an image.
- Parameters
-
string | $source | Path to source image |
string | $destination | Path to destination If not set, will modify the source image |
array | $params | An array of cropping/resizing parameters
- INT 'w' represents the width of the new image With upscaling disabled, this is the maximum width of the new image (in case the source image is smaller than the expected width)
- INT 'h' represents the height of the new image With upscaling disabled, this is the maximum height
- INT 'x1', 'y1', 'x2', 'y2' represent optional cropping coordinates. The source image will first be cropped to these coordinates, and then resized to match width/height parameters
- BOOL 'square' - square images will fill the bounding box (width x height). In Imagine's terms, this equates to OUTBOUND mode
- BOOL 'upscale' - if enabled, smaller images will be upscaled to fit the bounding box.
|
- Returns
- bool
Definition at line 84 of file ImageService.php.
Elgg\ImageService::$imagine |
|
protected |
const Elgg\ImageService::JPEG_QUALITY = 75 |
const Elgg\ImageService::WEBP_QUALITY = 75 |
The documentation for this class was generated from the following file: