class ImageService (View source)

An image service that acts as abstraction for the Imagine library

Properties

protected ImagineInterface $imagineService
protected ResourceManager $resourceManager
protected Environment $environment
protected AssetRepository $assetRepository
protected VariableFrontend $imageSizeCache
protected array $settings
static protected string[] $allowedFormats

Methods

void
injectSettings(array $settings)

No description

array
processImage(PersistentResource $originalResource, array $adjustments, string $format = null)

No description

array
getOptionsMergedWithDefaults(array $additionalOptions = [])

No description

array
getImageSize(PersistentResource $resource)

Get the size of a Flow PersistentResource that contains an image file.

ImageInterface
applyAdjustments(ImageInterface $image, array $adjustments, bool $adjustmentsApplied)

No description

bool
isAnimatedGif(string $image)

Detects whether the given GIF image data contains more than one frame

Details

void injectSettings(array $settings)

No description

Parameters

array $settings

Return Value

void

array processImage(PersistentResource $originalResource, array $adjustments, string $format = null)

No description

Parameters

PersistentResource $originalResource
array $adjustments
string $format

Return Value

array

resource, width, height as keys

Exceptions

ImageFileException
InvalidConfigurationException
Exception

protected array getOptionsMergedWithDefaults(array $additionalOptions = [])

No description

Parameters

array $additionalOptions

Return Value

array

Exceptions

InvalidConfigurationException

array getImageSize(PersistentResource $resource)

Get the size of a Flow PersistentResource that contains an image file.

Parameters

PersistentResource $resource

Return Value

array

width and height as keys

Exceptions

ImageFileException

protected ImageInterface applyAdjustments(ImageInterface $image, array $adjustments, bool $adjustmentsApplied)

No description

Parameters

ImageInterface $image
array $adjustments

Ordered list of adjustments to apply.

bool $adjustmentsApplied

Reference to a variable that will hold information if an adjustment was actually applied.

Return Value

ImageInterface

Exceptions

ImageServiceException

protected bool isAnimatedGif(string $image)

Detects whether the given GIF image data contains more than one frame

Parameters

string $image

string containing the binary GIF data

Return Value

bool

true if gif contains more than one frame