ImageService implements SingletonInterface

Service for processing images

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$resourceFactory  : ResourceFactory

Methods

__construct()  : mixed
ImageService constructor.
applyProcessingInstructions()  : ProcessedFile
Create a processed file
getImage()  : FileInterface
Get File or FileReference object
getImageUri()  : string
Get public url of image depending on the environment
getCompatibilityImageResourceValues()  : array<string|int, mixed>
Calculates the compatibility values This is duplicate code taken from ContentObjectRenderer::getImgResource() Ideally we should get rid of this code in both places.
getImageFromSourceString()  : FileInterface|null
Get File or FileReference object by src
setCompatibilityValues()  : void
Set compatibility values to frontend controller object 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
Internal
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

getCompatibilityImageResourceValues()

Calculates the compatibility values This is duplicate code taken from ContentObjectRenderer::getImgResource() Ideally we should get rid of this code in both places.

protected getCompatibilityImageResourceValues(ProcessedFile $processedImage) : array<string|int, mixed>
Parameters
$processedImage : ProcessedFile
Return values
array<string|int, mixed>

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 to frontend controller object in case we are in frontend environment.

protected setCompatibilityValues(ProcessedFile $processedImage) : void
Parameters
$processedImage : ProcessedFile

        
On this page

Search results