ImageService

readonly class \TYPO3\CMS\Extbase\Service\ImageService

Service for processing images

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Properties

$resourceFactory  : ResourceFactory

Methods

__construct()  : mixed
applyProcessingInstructions()  : ProcessedFile
Create a processed file
getImage()  : FileInterface
Get File or FileReference object
getImageUri()  : string
Get public url of image depending on the environment
getImageFromSourceString()  : FileInterface|null
Get File or FileReference object by src
setCompatibilityValues()  : void
Set compatibility values in case we are in frontend environment.

Properties

Methods

getImage()

Get File or FileReference object

public getImage(string $src, FileInterface|FileReference|null $image, bool $treatIdAsReference) : FileInterface

This method is a factory and compatibility method that does not belong to this service, but is put here for pragmatic reasons for the time being. It should be removed once we do not support string sources for images anymore.

Parameters

$src : string
$image : FileInterface|FileReference|null
$treatIdAsReference : bool

Tags

throws
UnexpectedValueException

Return values

FileInterface

getImageUri()

Get public url of image depending on the environment

public getImageUri(FileInterface $image[, bool|false $absolute = false ]) : string

Parameters

$image : FileInterface
$absolute : bool|false = false

Force absolute URL

Return values

string

getImageFromSourceString()

Get File or FileReference object by src

protected getImageFromSourceString(string $src, bool $treatIdAsReference) : FileInterface|null

Parameters

$src : string
$treatIdAsReference : bool

Return values

FileInterface|null

setCompatibilityValues()

Set compatibility values in case we are in frontend environment.

protected setCompatibilityValues(ProcessedFile $processedImage) : void

Parameters

$processedImage : ProcessedFile
On this page