ImageService
Read onlyYes
Service for processing images
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Properties
Methods
- __construct() : mixed
- applyProcessingInstructions() : ProcessedFile
- Create a processed file
- getImage() : File|FileReference
- 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
$linkService
protected
LinkService
$linkService
$resourceFactory
protected
ResourceFactory
$resourceFactory
Methods
__construct()
public
__construct(ResourceFactory $resourceFactory, LinkService $linkService) : mixed
Parameters
- $resourceFactory : ResourceFactory
- $linkService : LinkService
applyProcessingInstructions()
Create a processed file
public
applyProcessingInstructions(File|FileReference $image, array<string|int, mixed> $processingInstructions) : ProcessedFile
Parameters
- $image : File|FileReference
- $processingInstructions : array<string|int, mixed>
Return values
ProcessedFilegetImage()
Get File or FileReference object
public
getImage(string $src, FileInterface|FileReference|null $image, bool $treatIdAsReference) : File|FileReference
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
File|FileReferencegetImageUri()
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 in case we are in frontend environment.
protected
setCompatibilityValues(ProcessedFile $processedImage) : void
Parameters
- $processedImage : ProcessedFile