TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\Service\ImageService Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Service\ImageService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 injectResourceFactory (\TYPO3\CMS\Core\Resource\ResourceFactory $resourceFactory)
 
 injectEnvironmentService (\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService)
 
 applyProcessingInstructions ($image, $processingInstructions)
 
 getImageUri (FileInterface $image, $absolute=false)
 
 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 63 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 189 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
bool$treatIdAsReference
Returns
FileInterface
Exceptions

Definition at line 123 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
bool$treatIdAsReference
Returns
FileInterface|FileReference|

Definition at line 147 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,
  $absolute = false 
)

Get public url of image depending on the environment

Parameters
FileInterface$image
bool | FALSE$absoluteForce absolute URL
Returns
string

Definition at line 84 of file ImageService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv(), TYPO3\CMS\Core\Resource\FileInterface\getPublicUrl(), and TYPO3\CMS\Core\Utility\GeneralUtility\locationHeaderUrl().

◆ injectEnvironmentService()

TYPO3\CMS\Extbase\Service\ImageService::injectEnvironmentService ( \TYPO3\CMS\Extbase\Service\EnvironmentService  $environmentService)
Parameters
\TYPO3\CMS\Extbase\Service\EnvironmentService$environmentService

Definition at line 50 of file ImageService.php.

References TYPO3\CMS\Extbase\Service\ImageService\$environmentService.

◆ injectResourceFactory()

TYPO3\CMS\Extbase\Service\ImageService::injectResourceFactory ( \TYPO3\CMS\Core\Resource\ResourceFactory  $resourceFactory)
Parameters
\TYPO3\CMS\Core\Resource\ResourceFactory$resourceFactory

Definition at line 42 of file ImageService.php.

References TYPO3\CMS\Extbase\Service\ImageService\$resourceFactory.

◆ 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 172 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

◆ $resourceFactory

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