TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ImageService Class Reference
Inheritance diagram for ImageService:
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 (   $image,
  $processingInstructions 
)

Create a processed file

Parameters
File | FileReference$image
array$processingInstructions
Returns
ProcessedFile

Definition at line 63 of file ImageService.php.

References ProcessedFile\CONTEXT_IMAGECROPSCALEMASK, and ImageService\setCompatibilityValues().

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

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

Referenced by ImageService\setCompatibilityValues().

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
\UnexpectedValueException

Definition at line 123 of file ImageService.php.

References elseif, and ImageService\getImageFromSourceString().

getImageFromSourceString (   $src,
  $treatIdAsReference 
)
protected

Get File or FileReference object by src

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

Definition at line 146 of file ImageService.php.

References MathUtility\canBeInterpretedAsInteger().

Referenced by ImageService\getImage().

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, elseif, GeneralUtility\getIndpEnv(), FileInterface\getPublicUrl(), and GeneralUtility\locationHeaderUrl().

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

Definition at line 50 of file ImageService.php.

References ImageService\$environmentService.

injectResourceFactory ( \TYPO3\CMS\Core\Resource\ResourceFactory  $resourceFactory)
Parameters
\TYPO3\CMS\Core\Resource\ResourceFactory$resourceFactory

Definition at line 42 of file ImageService.php.

References ImageService\$resourceFactory.

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

References $GLOBALS, and ImageService\getCompatibilityImageResourceValues().

Referenced by ImageService\applyProcessingInstructions().

Member Data Documentation

$environmentService
protected

Definition at line 37 of file ImageService.php.

Referenced by ImageService\injectEnvironmentService().

$resourceFactory
protected

Definition at line 32 of file ImageService.php.

Referenced by ImageService\injectResourceFactory().