TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Service\ImageService Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Service\ImageService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 applyProcessingInstructions ($image, $processingInstructions)
 
 getImageUri (FileInterface $image)
 
 getImage ($src, $image, $treatIdAsReference)
 

Protected Member Functions

 getImageFromSourceString ($src, $treatIdAsReference)
 
 setCompatibilityValues (ProcessedFile $processedImage)
 
 getCompatibilityImageResourceValues (ProcessedFile $processedImage)
 

Protected Attributes

 $resourceFactory
 
 $environmentService
 

Detailed Description

Service for processing images

Definition at line 27 of file ImageService.php.

Member Function Documentation

◆ applyProcessingInstructions()

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

Create a processed file

Parameters
File | FileReference$image
array$processingInstructions
Returns
ProcessedFile

Definition at line 49 of file ImageService.php.

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

◆ getCompatibilityImageResourceValues()

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 160 of file ImageService.php.

References $GLOBALS, TYPO3\CMS\Core\Resource\ProcessedFile\calculateChecksum(), TYPO3\CMS\Core\Resource\AbstractFile\getExtension(), TYPO3\CMS\Core\Resource\ProcessedFile\getOriginalFile(), TYPO3\CMS\Core\Resource\ProcessedFile\getProperty(), and TYPO3\CMS\Core\Resource\ProcessedFile\getPublicUrl().

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

◆ getImage()

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
boolean$treatIdAsReference
Returns
FileInterface
Exceptions

Definition at line 98 of file ImageService.php.

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

◆ getImageFromSourceString()

TYPO3\CMS\Extbase\Service\ImageService::getImageFromSourceString (   $src,
  $treatIdAsReference 
)
protected

Get File or FileReference object by src

Parameters
string$src
boolean$treatIdAsReference
Returns
FileInterface|FileReference|

Definition at line 120 of file ImageService.php.

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

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

◆ getImageUri()

TYPO3\CMS\Extbase\Service\ImageService::getImageUri ( FileInterface  $image)

Get public url of image depending on the environment

Parameters
FileInterface$image
Returns
string

Definition at line 68 of file ImageService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv(), 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
Returns
void

Definition at line 144 of file ImageService.php.

References $GLOBALS, and TYPO3\CMS\Extbase\Service\ImageService\getCompatibilityImageResourceValues().

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

Member Data Documentation

◆ $environmentService

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

Definition at line 39 of file ImageService.php.

◆ $resourceFactory

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

Definition at line 33 of file ImageService.php.