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_... constants).

Methods

__construct(string $directoryName, string $handle, string $name, int|null $width, int|null $height, bool $isDoubledVersion = false, string $sizingMode = ThumbnailType::RESIZE_DEFAULT)

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.

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).

Details

__construct(string $directoryName, string $handle, string $name, int|null $width, int|null $height, bool $isDoubledVersion = false, string $sizingMode = ThumbnailType::RESIZE_DEFAULT)

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)

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

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

Examples

/thumbnails/file_manager_detail/0000/0000/0000/file.png