Class Image
Contains helper methods concerned with image manipulation.
Methods summary
public static
array
|
#
createCroppedThumbnail( string $imagePath, array $thumbsSizes, integer $quality = 95 )
Generate one or more center cropped thumbnails given thumbnail sizes.
Generate one or more center cropped thumbnails given thumbnail sizes.
Parameters
- $imagePath
- Path to the input image file.
- $thumbsSizes
- Array with thumb sizes. Example: ['150x150', '240x320', '640x480'].
- $quality
- Image compression quality (only for JPG and PNG).
Returns
array Of paths to the newly created thumbnails.
Uses
self::createThumbnail To create a thumbnail from the given image.
|
public static
array
|
#
createScaledThumbnail( string $imagePath, array $thumbsSizes, integer $quality = 95 )
Generate one or more scaled thumbnails that fit in the given sizes.
Generate one or more scaled thumbnails that fit in the given sizes.
Parameters
- $imagePath
- Path to the input image file.
- $thumbsSizes
- Array with thumb sizes. Example: ['150x150', '240x320', '640x480'].
- $quality
- Image compression quality (only for JPG and PNG).
Returns
array Of paths to the newly created thumbnails.
Uses
self::createThumbnail To create a thumbnail from the given image.
|
public static
array
|
#
getSize( string $imagePath )
Gets image size and aspect ratio.
Gets image size and aspect ratio.
Parameters
- $imagePath
- Image file path.
Returns
array With width, height, and aspect ratio.
|
public static
string
|
#
getThumbnailFilePath( string $imagePath, string $size, string $type )
Retrieve thumbnail file path.
Retrieve thumbnail file path.
Parameters
- $imagePath
- Path to the original image file.
- $size
- Thumbnail size.
- $type
- Thumbnail type.
Returns
string
|
private static
array
|
#
createThumbnail( string $imagePath, array $thumbsSizes, integer $quality, string $mode )
Generate one or more thumbnails of an input file.
Generate one or more thumbnails of an input file.
Parameters
- $imagePath
- Path to the input image file.
- $thumbsSizes
- Array with thumb sizes. Example: ['150x150', '240x320', '640x480'].
- $quality
- Image compression quality (only for JPG and PNG).
- $mode
- Used by thumbnail creation. Can be either inset or outbound.
Returns
array Of paths to the newly created thumbnails.
|