class ThumbnailFormatService (View source)

Constants

FORMAT_PNG

Thumbnail format: PNG.

FORMAT_JPEG

Thumbnail format: JPEG.

FORMAT_AUTO

Thumbnail format: automatic.

Properties

protected Repository $config
protected File $fileService

Methods

__construct(Repository $config, File $fileService)

No description

string
getFormatForFile(File|Version|string $file)

Get the format to be used for a specific file (using the configured format option).

string
getAutomaticFormatForFile(File|Version|string $file)

Get the format to be used for a specific file (calculating if from the file extension).

string
getFormatForFileExtension(string $extension)

Get the format to be used for a specific file extension (using the configured format option).

string
getAutomaticFormatForFileExtension(string $extension)

Get the format to be used for a specific file extension (calculating if from the file extension).

string
getConfiguredFormat()

Get the configured format.

Details

__construct(Repository $config, File $fileService)

No description

Parameters

Repository $config
File $fileService

string getFormatForFile(File|Version|string $file)

Get the format to be used for a specific file (using the configured format option).

Parameters

File|Version|string $file

A File of file Version instance, or a file name

Return Value

string

One of the ThumbnailFormatService::FORMAT_... constants (except FORMAT_AUTO)

string getAutomaticFormatForFile(File|Version|string $file)

Get the format to be used for a specific file (calculating if from the file extension).

Parameters

File|Version|string $file

A File of file Version instance, or a file name

Return Value

string

One of the ThumbnailFormatService::FORMAT_... constants (except FORMAT_AUTO)

string getFormatForFileExtension(string $extension)

Get the format to be used for a specific file extension (using the configured format option).

Parameters

string $extension

Return Value

string

One of the ThumbnailFormatService::FORMAT_... constants (except FORMAT_AUTO)

string getAutomaticFormatForFileExtension(string $extension)

Get the format to be used for a specific file extension (calculating if from the file extension).

Parameters

string $extension

the file extension (with or without a leading dot)

Return Value

string

One of the ThumbnailFormatService::FORMAT_... constants (except FORMAT_AUTO)

protected string getConfiguredFormat()

Get the configured format.

Return Value

string

One of the FORMAT_... constants