class Thumbnail implements ImageInterface (View source)

A system-generated preview version of an Asset

Traits

Trait for methods regarding the dimensions of an asset

Trait for methods regarding the quality of an asset

Properties

protected int $width from  DimensionsTrait
protected int $height from  DimensionsTrait
protected int $quality from  QualityTrait
protected ThumbnailGeneratorStrategy $generatorStrategy
protected ThumbnailService $thumbnailService
protected Asset $originalAsset
protected PersistentResource $resource
protected string $staticResource
protected string[] $configuration
protected string $configurationHash
protected bool $async

Methods

int
getWidth()

Width of the image in pixels

int
getHeight()

Height of the image in pixels

bool
hasDimensions()

Does the asset have dimensions

float
getAspectRatio(bool $respectOrientation = false)

Edge / aspect ratio of the image

string
getOrientation()

Orientation of this image, i.e. portrait, landscape or square

bool
isOrientationSquare()

Whether this image is square aspect ratio and therefore has a square orientation

bool
isOrientationLandscape()

Whether this image is in landscape orientation

bool
isOrientationPortrait()

Whether this image is in portrait orientation

int
getQuality()

Returns the quality of the image

__construct(AssetInterface $originalAsset, ThumbnailConfiguration $configuration)

Constructs a new Thumbnail

void
initializeObject(int $initializationCause)

Initializes this thumbnail

onPostPersist()

Post persistence lifecycle callback

getOriginalAsset()

Returns the Asset this thumbnail is derived from

void
setConfiguration(ThumbnailConfiguration $configuration)

No description

mixed
getConfigurationValue(string $value)

No description

PersistentResource
getResource()

PersistentResource of this thumbnail

void
setResource(PersistentResource $resource)

No description

string
getStaticResource()

No description

void
setStaticResource(string $staticResource)

No description

void
setWidth(int $width)

No description

void
setHeight(int $height)

No description

void
setQuality(int $quality)

No description

void
refresh()

Refreshes this asset after the PersistentResource has been modified

Details

int getWidth()

Width of the image in pixels

Return Value

int

int getHeight()

Height of the image in pixels

Return Value

int

bool hasDimensions()

Does the asset have dimensions

Return Value

bool

float getAspectRatio(bool $respectOrientation = false)

Edge / aspect ratio of the image

Parameters

bool $respectOrientation

If false (the default), orientation is disregarded and always a value >= 1 is returned (like usual in "4 / 3" or "16 / 9")

Return Value

float

string getOrientation()

Orientation of this image, i.e. portrait, landscape or square

Return Value

string

One of this interface's ORIENTATION_* constants.

bool isOrientationSquare()

Whether this image is square aspect ratio and therefore has a square orientation

Return Value

bool

bool isOrientationLandscape()

Whether this image is in landscape orientation

Return Value

bool

bool isOrientationPortrait()

Whether this image is in portrait orientation

Return Value

bool

int getQuality()

Returns the quality of the image

Return Value

int

__construct(AssetInterface $originalAsset, ThumbnailConfiguration $configuration)

Constructs a new Thumbnail

Parameters

AssetInterface $originalAsset

The original asset this variant is derived from

ThumbnailConfiguration $configuration

Exceptions

Exception

void initializeObject(int $initializationCause)

Initializes this thumbnail

Parameters

int $initializationCause

Return Value

void

onPostPersist()

Post persistence lifecycle callback

ImageInterface getOriginalAsset()

Returns the Asset this thumbnail is derived from

Return Value

ImageInterface

protected void setConfiguration(ThumbnailConfiguration $configuration)

No description

Parameters

ThumbnailConfiguration $configuration

Return Value

void

mixed getConfigurationValue(string $value)

No description

Parameters

string $value

Return Value

mixed

PersistentResource getResource()

PersistentResource of this thumbnail

Return Value

PersistentResource

void setResource(PersistentResource $resource)

No description

Parameters

PersistentResource $resource

Return Value

void

string getStaticResource()

No description

Return Value

string

void setStaticResource(string $staticResource)

No description

Parameters

string $staticResource

Return Value

void

void setWidth(int $width)

No description

Parameters

int $width

Return Value

void

void setHeight(int $height)

No description

Parameters

int $height

Return Value

void

void setQuality(int $quality)

No description

Parameters

int $quality

Return Value

void

void refresh()

Refreshes this asset after the PersistentResource has been modified

Return Value

void