‪TYPO3CMS  9.5
TYPO3\CMS\Extbase\Service\ImageService Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Service\ImageService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (EnvironmentService $environmentService=null, ResourceFactory $resourceFactory=null)
 
ProcessedFile applyProcessingInstructions ($image, $processingInstructions)
 
string getImageUri (FileInterface $image, $absolute=false)
 
FileInterface FileReference getImage ($src, $image, $treatIdAsReference)
 

Protected Member Functions

FileInterface FileReference TYPO3 CMS Core Resource Folder getImageFromSourceString ($src, $treatIdAsReference)
 
 setCompatibilityValues (ProcessedFile $processedImage)
 
array getCompatibilityImageResourceValues (ProcessedFile $processedImage)
 

Protected Attributes

ResourceFactory $resourceFactory
 
EnvironmentService $environmentService
 

Detailed Description

Service for processing images

Definition at line 29 of file ImageService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Service\ImageService::__construct ( EnvironmentService  $environmentService = null,
ResourceFactory  $resourceFactory = null 
)

ImageService constructor.

Parameters
EnvironmentService | null$environmentService
ResourceFactory | null$resourceFactory

Definition at line 45 of file ImageService.php.

References TYPO3\CMS\Extbase\Service\ImageService\$environmentService, TYPO3\CMS\Extbase\Service\ImageService\$resourceFactory, and TYPO3\CMS\Core\Resource\ResourceFactory\getInstance().

Member Function Documentation

◆ applyProcessingInstructions()

ProcessedFile TYPO3\CMS\Extbase\Service\ImageService::applyProcessingInstructions (   $image,
  $processingInstructions 
)

Create a processed file

Parameters
FileInterface | FileReference$image
array$processingInstructions
Returns
‪ProcessedFile

Definition at line 58 of file ImageService.php.

References TYPO3\CMS\Core\Resource\ProcessedFile\CONTEXT_IMAGECROPSCALEMASK, TYPO3\CMS\Core\Resource\ProcessedFile\getOriginalFile(), TYPO3\CMS\Core\Resource\File\process(), and TYPO3\CMS\Extbase\Service\ImageService\setCompatibilityValues().

◆ getCompatibilityImageResourceValues()

array TYPO3\CMS\Extbase\Service\ImageService::getCompatibilityImageResourceValues ( ProcessedFile  $processedImage)
protected

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

Parameters
ProcessedFile$processedImage
Returns
‪array

Definition at line 185 of file ImageService.php.

References TYPO3\CMS\Core\Resource\AbstractFile\getExtension(), TYPO3\CMS\Core\Resource\AbstractFile\getModificationTime(), TYPO3\CMS\Core\Resource\ProcessedFile\getOriginalFile(), TYPO3\CMS\Core\Resource\ProcessedFile\getProperty(), TYPO3\CMS\Core\Resource\File\getPublicUrl(), and TYPO3\CMS\Core\Resource\ProcessedFile\getPublicUrl().

Referenced by TYPO3\CMS\Extbase\Service\ImageService\setCompatibilityValues().

◆ getImage()

FileInterface FileReference TYPO3\CMS\Extbase\Service\ImageService::getImage (   $src,
  $image,
  $treatIdAsReference 
)

Get File or FileReference object

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
string$src
mixed$image
bool$treatIdAsReference
Returns
‪FileInterface|FileReference
Exceptions

Definition at line 116 of file ImageService.php.

References TYPO3\CMS\Extbase\Service\ImageService\getImageFromSourceString().

◆ getImageFromSourceString()

FileInterface FileReference TYPO3 CMS Core Resource Folder TYPO3\CMS\Extbase\Service\ImageService::getImageFromSourceString (   $src,
  $treatIdAsReference 
)
protected

Get File or FileReference object by src

Parameters
string$src
bool$treatIdAsReference
Returns
‪FileInterface|FileReference|\TYPO3\CMS\Core\Resource\Folder

Definition at line 140 of file ImageService.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Extbase\Service\ImageService\getImage().

◆ getImageUri()

string TYPO3\CMS\Extbase\Service\ImageService::getImageUri ( FileInterface  $image,
  $absolute = false 
)

Get public url of image depending on the environment

Parameters
FileInterface$image
bool | false$absolute‪Force absolute URL
Returns
‪string

Definition at line 78 of file ImageService.php.

References $GLOBALS, and TYPO3\CMS\Core\Resource\FileInterface\getPublicUrl().

◆ setCompatibilityValues()

TYPO3\CMS\Extbase\Service\ImageService::setCompatibilityValues ( ProcessedFile  $processedImage)
protected

Set compatibility values to frontend controller object in case we are in frontend environment.

Parameters
ProcessedFile$processedImage

Definition at line 169 of file ImageService.php.

References $GLOBALS, TYPO3\CMS\Extbase\Service\ImageService\getCompatibilityImageResourceValues(), and TYPO3\CMS\Core\Resource\ProcessedFile\getPublicUrl().

Referenced by TYPO3\CMS\Extbase\Service\ImageService\applyProcessingInstructions().

Member Data Documentation

◆ $environmentService

EnvironmentService TYPO3\CMS\Extbase\Service\ImageService::$environmentService
protected

Definition at line 37 of file ImageService.php.

Referenced by TYPO3\CMS\Extbase\Service\ImageService\__construct().

◆ $resourceFactory

ResourceFactory TYPO3\CMS\Extbase\Service\ImageService::$resourceFactory
protected

Definition at line 33 of file ImageService.php.

Referenced by TYPO3\CMS\Extbase\Service\ImageService\__construct().