‪TYPO3CMS  11.5
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 string renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 

Static Protected Member Functions

static ImageService getImageService ()
 

Detailed Description

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

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 85 of file ImageViewHelper.php.

Member Function Documentation

◆ getImageService()

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

Return an instance of ImageService using object manager

Returns
‪ImageService

Definition at line 185 of file ImageViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper\renderStatic().

◆ initializeArguments()

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

Initialize arguments

Definition at line 91 of file ImageViewHelper.php.

◆ renderStatic()

static string 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

Parameters
array$arguments
\Closure$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
‪string
Exceptions
Exception

Definition at line 118 of file ImageViewHelper.php.

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