ImageService implements SingletonInterface
Service for processing images
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
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
- 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
$resourceFactory
protected
ResourceFactory
$resourceFactory
Methods
__construct()
ImageService constructor.
public
__construct(ResourceFactory $resourceFactory) : mixed
Parameters
- $resourceFactory : ResourceFactory
applyProcessingInstructions()
Create a processed file
public
applyProcessingInstructions(FileInterface|FileReference $image, array<string|int, mixed> $processingInstructions) : ProcessedFile
Parameters
- $image : FileInterface|FileReference
- $processingInstructions : array<string|int, mixed>
Return values
ProcessedFilegetImage()
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
Return values
FileInterfacegetImageUri()
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
stringgetImageFromSourceString()
Get File or FileReference object by src
protected
getImageFromSourceString(string $src, bool $treatIdAsReference) : FileInterface|null
Parameters
- $src : string
- $treatIdAsReference : bool
Return values
FileInterface|nullsetCompatibilityValues()
Set compatibility values to frontend controller object in case we are in frontend environment.
protected
setCompatibilityValues(ProcessedFile $processedImage) : void
Parameters
- $processedImage : ProcessedFile