‪TYPO3CMS  11.5
TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper:
TYPO3\CMS\Backend\ViewHelpers\ThumbnailViewHelper

Public Member Functions

 __construct ()
 
 initializeArguments ()
 
string render ()
 

Protected Attributes

string $tagName = 'img'
 
ImageService $imageService
 

Detailed Description

Resizes a given image (if required) and renders the respective img tag.

External URLs are not processed. Only a given width and height will be set on the tag.

Examples

Default

::

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

Output in frontend::

alt text

or in backend::

alt text

Image Object

::

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

Output::

alt set in image record

Inline notation

::

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

Output::

alt text

Depending on your TYPO3s encryption key.

Other resource type (e.g. PDF)

::

<f:image src="fileadmin/user_upload/example.pdf" alt="foo" />

If your graphics processing library is set up correctly then it will output a thumbnail of the first page of your PDF document: <img src="fileadmin/_processed_/1/2/csm_example_aabbcc112233.gif" width="200" height="284" alt="foo">

Non-existent image

::

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

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

Definition at line 91 of file ImageViewHelper.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::__construct ( )

Definition at line 99 of file ImageViewHelper.php.

Member Function Documentation

◆ initializeArguments()

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

Initialize arguments.

Reimplemented in TYPO3\CMS\Backend\ViewHelpers\ThumbnailViewHelper.

Definition at line 108 of file ImageViewHelper.php.

◆ render()

string TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::render ( )

Resizes a given image (if required) and renders the respective img tag

See also
https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Image/
Exceptions
Exception
Returns
‪string Rendered tag

Reimplemented in TYPO3\CMS\Backend\ViewHelpers\ThumbnailViewHelper.

Definition at line 143 of file ImageViewHelper.php.

References $GLOBALS, and TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection\create().

Member Data Documentation

◆ $imageService

ImageService TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::$imageService
protected

Definition at line 97 of file ImageViewHelper.php.

◆ $tagName

string TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::$tagName = 'img'
protected

Definition at line 95 of file ImageViewHelper.php.