class ThumbnailService (View source)

An internal thumbnail service.

Note that this repository is not part of the public API. Use the asset's getThumbnail() method instead.

Properties

protected ThumbnailRepository $thumbnailRepository
protected PersistenceManagerInterface $persistenceManager
protected ResourceManager $resourceManager
protected array $formatConversions
protected array $presets
protected array $thumbnailCache
protected LoggerInterface $logger
protected ThrowableStorageInterface $throwableStorage

Methods

ImageInterface|null
getThumbnail(AssetInterface $asset, ThumbnailConfiguration $configuration)

Returns a thumbnail of the given asset

array
getPresets()

No description

getThumbnailConfigurationForPreset(string $preset, bool $async = false)

No description

applyFormatToThumbnailConfiguration(ThumbnailConfiguration $configuration, string $targetFormat)

Create a new thumbnailConfiguration with the identical configuration to the given one PLUS setting of the target-format

void
refreshThumbnail(Thumbnail $thumbnail)

Refreshes a thumbnail and persists the thumbnail

string
getUriForThumbnail(ImageInterface $thumbnail)

No description

void
emitThumbnailPersisted(Thumbnail $thumbnail)

Signals that a thumbnail was persisted.

void
emitThumbnailCreated(Thumbnail $thumbnail)

Signals that a thumbnail was created.

Details

ImageInterface|null getThumbnail(AssetInterface $asset, ThumbnailConfiguration $configuration)

Returns a thumbnail of the given asset

If the maximum width / height is not specified or exceeds the original asset's dimensions, the width / height of the original asset is used.

Parameters

AssetInterface $asset

The asset to render a thumbnail for

ThumbnailConfiguration $configuration

Return Value

ImageInterface|null

Exceptions

Exception

array getPresets()

No description

Return Value

array

Returns preset configuration for all presets

ThumbnailConfiguration getThumbnailConfigurationForPreset(string $preset, bool $async = false)

No description

Parameters

string $preset

The preset identifier

bool $async

Return Value

ThumbnailConfiguration

Exceptions

ThumbnailServiceException

protected ThumbnailConfiguration applyFormatToThumbnailConfiguration(ThumbnailConfiguration $configuration, string $targetFormat)

Create a new thumbnailConfiguration with the identical configuration to the given one PLUS setting of the target-format

Parameters

ThumbnailConfiguration $configuration
string $targetFormat

Return Value

ThumbnailConfiguration

void refreshThumbnail(Thumbnail $thumbnail)

Refreshes a thumbnail and persists the thumbnail

Parameters

Thumbnail $thumbnail

Return Value

void

Exceptions

IllegalObjectTypeException

string getUriForThumbnail(ImageInterface $thumbnail)

No description

Parameters

ImageInterface $thumbnail

Return Value

string

Exceptions

ThumbnailServiceException

void emitThumbnailPersisted(Thumbnail $thumbnail)

Signals that a thumbnail was persisted.

Parameters

Thumbnail $thumbnail

Return Value

void

protected void emitThumbnailCreated(Thumbnail $thumbnail)

Signals that a thumbnail was created.

Parameters

Thumbnail $thumbnail

Return Value

void