‪TYPO3CMS  ‪main
TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper:

Public Member Functions

 initializeArguments ()
 

Static Public Member Functions

static renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 

Static Protected Member Functions

static getExceptionMessage (string $detailedMessage, RenderingContextInterface $renderingContext)
 
static getImageService ()
 

Detailed Description

Resizes a given image (if required) and returns its relative path.

This ViewHelper should only be used for images within FAL storages, or where graphical operations shall be performed.

Note that when the contents of a non-FAL image are changed, an image may not show updated processed contents unless either the FAL record is updated/removed, or the temporary processed images are cleared.

Also note that image operations (cropping, scaling, converting) on non-FAL files may be changed in future TYPO3 versions, since those operations are coupled with FAL metadata. Each non-FAL image operation creates a "fake" FAL record, which may lead to problems.

For extension resource files, use :ref:<f:uri.resource> <typo3-fluid-uri-resource> instead.

External URLs are not processed and just returned as is.

Examples

Default

::

<f:uri.image src="EXT:myext/Resources/Public/typo3_logo.png" />

Results in the following output within TYPO3 frontend:

typo3conf/ext/myext/Resources/Public/typo3_logo.png

and the following output inside TYPO3 backend:

../typo3conf/ext/myext/Resources/Public/typo3_logo.png

Image Object

::

<f:uri.image image="{imageObject}" />

Results in the following output within TYPO3 frontend:

fileadmin/images/image.png

and the following output inside TYPO3 backend:

fileadmin/images/image.png

Inline notation

::

{f:uri.image(src: 'EXT:myext/Resources/Public/typo3_logo.png', minWidth: 30, maxWidth: 40)}

typo3temp/assets/images/[b4c0e7ed5c].png

Depending on your TYPO3s encryption key.

Non existing image

::

<f:uri.image src="NonExistingImage.png" />

Could not get image resource for "NonExistingImage.png".

Definition at line 106 of file ImageViewHelper.php.

Member Function Documentation

◆ getExceptionMessage()

static TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::getExceptionMessage ( string  $detailedMessage,
RenderingContextInterface  $renderingContext 
)
staticprotected

Definition at line 198 of file ImageViewHelper.php.

◆ getImageService()

static TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::getImageService ( )
staticprotected

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::initializeArguments ( )

Definition at line 109 of file ImageViewHelper.php.

◆ renderStatic()

static TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static

Resizes the image (if required) and returns its path. If the image was not resized, the path will be equal to $src

Exceptions
Exception

Definition at line 132 of file ImageViewHelper.php.

References $GLOBALS, TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection\create(), TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper\getImageService(), and TYPO3\CMS\Core\Utility\GeneralUtility\inList().