class Version (View source)

Handles regular and retina thumbnails. e.g. Each thumbnail type has two versions of itself the regular one and the 2x one.

Properties

protected string $directoryName The name of the directory that contains the thumbnails.
protected string $handle The handle of the thumbnail type version.
protected string $name The name of the thumbnail type version.
protected int|null $width The width of the thumbnails (or the maximum width in case of proportional sizing).
protected int|null $height The height of the thumbnails (or the maximum height in case of proportional sizing).
protected bool $isDoubledVersion Is this a high-DPI thumbnail type version?
protected string $sizingMode The thumbnail sizing mode (one of the \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type::RESIZE_.
protected bool $upscalingEnabled Upscaling is enabled?
protected bool $limitedToFileSets Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?
protected int[] $associatedFileSetIDs Associated file set IDs (whose meaning depends on the value of limitedToFileSets).
protected bool $keepAnimations Should we create animated thumbnails for animated images?
protected string $saveAreaBackgroundColor Background color of the Image Editor save area

Methods

__construct(string $directoryName, string $handle, string $name, int|null $width, int|null $height, bool $isDoubledVersion = false, string $sizingMode = ThumbnailType::RESIZE_DEFAULT, bool $limitedToFileSets = false, array $associatedFileSetIDs = [], bool $upscalingEnabled = false, bool $keepAnimations = false, string $saveAreaBackgroundColor = '')

Initialize the instance.

static Version|null
getByHandle(string $handle)

Get a thumbnail type version given its handle.

setDirectoryName(string $directoryName)

Set the name of the directory that contains the thumbnails.

string
getDirectoryName()

Get the name of the directory that contains the thumbnails.

setHandle(string $handle)

Set the handle of the thumbnail type version.

string
getHandle()

Get the handle of the thumbnail type version.

setName(string $name)

Set the name of the thumbnail type version.

string
getName()

Get the name of the thumbnail type version.

string
getDisplayName(string $format = 'html')

Get the display name for this thumbnail type version (localized and escaped accordingly to $format).

setWidth(int|null $width)

Set the width of the thumbnails (or the maximum width in case of proportional sizing).

int|null
getWidth()

Get the width of the thumbnails (or the maximum width in case of proportional sizing).

setHeight(int|null $height)

Set the height of the thumbnails (or the maximum height in case of proportional sizing).

int|null
getHeight()

Get the height of the thumbnails (or the maximum height in case of proportional sizing).

setSizingMode(string $sizingMode)

Set the thumbnail sizing mode.

string
getSizingMode()

Get the thumbnail sizing mode.

setIsUpscalingEnabled(bool $value)

Is upscaling enabled?

bool
isUpscalingEnabled()

Is upscaling enabled?

$this
setLimitedToFileSets(bool $value)

Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?

bool
isLimitedToFileSets()

Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?

$this
setAssociatedFileSetIDs(array $value)

Set the IDs of the associated file sets (whose meaning depends on the value of limitedToFileSets).

int[]
getAssociatedFileSetIDs()

Get the IDs of associated file sets (whose meaning depends on the value of limitedToFileSets).

setKeepAnimations(bool $value)

Should we create animated thumbnails for animated images?

bool
isKeepAnimations()

Should we create animated thumbnails for animated images?

$this
setSaveAreaBackgroundColor(string $color)

Background color of the Image Editor save area

string
getSaveAreaBackgroundColor()

Background color of the Image Editor save area

string
getSizingModeDisplayName()

Get the display name of the thumbnail sizing mode.

string
getFilePath(Version $fv)

Get the path to the thumbnail of a file version (relative to the to the storage location root).

bool
shouldExistFor(int $imageWidth, int $imageHeight, File $file = null)

Check if this thumbnail type version should exist for an image with the specified dimensions.

Details

__construct(string $directoryName, string $handle, string $name, int|null $width, int|null $height, bool $isDoubledVersion = false, string $sizingMode = ThumbnailType::RESIZE_DEFAULT, bool $limitedToFileSets = false, array $associatedFileSetIDs = [], bool $upscalingEnabled = false, bool $keepAnimations = false, string $saveAreaBackgroundColor = '')

Initialize the instance.

Parameters

string $directoryName the name of the directory that contains the thumbnails
string $handle the handle of the thumbnail type version
string $name the name of the thumbnail type versio
int|null $width the width of the thumbnails (or the maximum width in case of proportional sizing)
int|null $height the height of the thumbnails (or the maximum height in case of proportional sizing)
bool $isDoubledVersion is this a high-DPI thumbnail type version?
string $sizingMode the thumbnail sizing mode (one of the \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type::RESIZE_... constants)
bool $limitedToFileSets Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?
array $associatedFileSetIDs the IDs of the associated file sets (whose meaning depends on the value of $limitedToFileSets)
bool $upscalingEnabled Upscaling is enabled?
bool $keepAnimations Should we create animated thumbnails for animated images?
string $saveAreaBackgroundColor Background color of the Image Editor save area

static Version|null getByHandle(string $handle)

Get a thumbnail type version given its handle.

Parameters

string $handle

Return Value

Version|null

setDirectoryName(string $directoryName)

Set the name of the directory that contains the thumbnails.

Parameters

string $directoryName

string getDirectoryName()

Get the name of the directory that contains the thumbnails.

Return Value

string

setHandle(string $handle)

Set the handle of the thumbnail type version.

Parameters

string $handle

string getHandle()

Get the handle of the thumbnail type version.

Return Value

string

setName(string $name)

Set the name of the thumbnail type version.

Parameters

string $name

string getName()

Get the name of the thumbnail type version.

Return Value

string

string getDisplayName(string $format = 'html')

Get the display name for this thumbnail type version (localized and escaped accordingly to $format).

Parameters

string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.

Return Value

string

setWidth(int|null $width)

Set the width of the thumbnails (or the maximum width in case of proportional sizing).

Parameters

int|null $width

int|null getWidth()

Get the width of the thumbnails (or the maximum width in case of proportional sizing).

Return Value

int|null

setHeight(int|null $height)

Set the height of the thumbnails (or the maximum height in case of proportional sizing).

Parameters

int|null $height

int|null getHeight()

Get the height of the thumbnails (or the maximum height in case of proportional sizing).

Return Value

int|null

setSizingMode(string $sizingMode)

Set the thumbnail sizing mode.

Parameters

string $sizingMode One of the \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type::RESIZE_... constants

string getSizingMode()

Get the thumbnail sizing mode.

Return Value

string One of the \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type::RESIZE_... constants

setIsUpscalingEnabled(bool $value)

Is upscaling enabled?

Parameters

bool $value

bool isUpscalingEnabled()

Is upscaling enabled?

Return Value

bool

$this setLimitedToFileSets(bool $value)

Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?

Parameters

bool $value

Return Value

$this

bool isLimitedToFileSets()

Should the thumbnails be build for every file that ARE NOT in the file sets (false), or only for files that ARE in the specified file sets (true)?

Return Value

bool

$this setAssociatedFileSetIDs(array $value)

Set the IDs of the associated file sets (whose meaning depends on the value of limitedToFileSets).

Parameters

array $value

Return Value

$this

int[] getAssociatedFileSetIDs()

Get the IDs of associated file sets (whose meaning depends on the value of limitedToFileSets).

Return Value

int[]

setKeepAnimations(bool $value)

Should we create animated thumbnails for animated images?

Parameters

bool $value

bool isKeepAnimations()

Should we create animated thumbnails for animated images?

Return Value

bool

$this setSaveAreaBackgroundColor(string $color)

Background color of the Image Editor save area

Parameters

string $color

Return Value

$this

string getSaveAreaBackgroundColor()

Background color of the Image Editor save area

Return Value

string

string getSizingModeDisplayName()

Get the display name of the thumbnail sizing mode.

Return Value

string

string getFilePath(Version $fv)

Get the path to the thumbnail of a file version (relative to the to the storage location root).

Parameters

Version $fv the file version for which you want the path of the associated thumbnail

Return Value

string

bool shouldExistFor(int $imageWidth, int $imageHeight, File $file = null)

Check if this thumbnail type version should exist for an image with the specified dimensions.

Parameters

int $imageWidth The original image width
int $imageHeight The original image height
File $file The File instance to check file sets against

Return Value

bool