class ImageHelper implements ProtectedContextAwareInterface (View source)

Properties

protected ThumbnailService $thumbnailService

Methods

createThumbnail(AssetInterface|null $asset, string|null $preset = null, int|null $width = null, int|null $maximumWidth = null, int|null $height = null, int|null $maximumHeight = null, bool $allowCropping = false, bool $allowUpScaling = false, bool $async = false, int|null $quality = null, string|null $format = null)

Returns a thumbnail of the given asset, allowing integrators to access the thumbnail size and other metadata.

bool
allowsCallOfMethod(string $methodName)

All methods are considered safe

Details

ImageInterface|null createThumbnail(AssetInterface|null $asset, string|null $preset = null, int|null $width = null, int|null $maximumWidth = null, int|null $height = null, int|null $maximumHeight = null, bool $allowCropping = false, bool $allowUpScaling = false, bool $async = false, int|null $quality = null, string|null $format = null)

Returns a thumbnail of the given asset, allowing integrators to access the thumbnail size and other metadata.

Parameters

AssetInterface|null $asset
string|null $preset

Name of the preset that should be used as basis for the configuration

int|null $width

Desired width of the image

int|null $maximumWidth

Desired maximum width of the image

int|null $height

Desired height of the image

int|null $maximumHeight

Desired maximum height of the image

bool $allowCropping

Whether the image should be cropped if the given sizes would hurt the aspect ratio

bool $allowUpScaling

Whether the resulting image size might exceed the size of the original image

bool $async

Whether the thumbnail can be generated asynchronously

int|null $quality

Quality of the processed image

string|null $format

Format for the image, only jpg, jpeg, gif, png, wbmp, xbm, webp and bmp are supported.

Return Value

ImageInterface|null

Exceptions

ThumbnailServiceException

bool allowsCallOfMethod(string $methodName)

All methods are considered safe

Parameters

string $methodName

Return Value

bool