ImageViewHelper extends AbstractViewHelper uses CompileWithRenderStatic

ViewHelper

This class is the implementation of a Fluid ViewHelper.

View this class in the TYPO3 ViewHelper reference: <f:uri.image>

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".

Table of Contents

Methods

initializeArguments()  : mixed
Initialize arguments
renderStatic()  : string
Resizes the image (if required) and returns its path. If the image was not resized, the path will be equal to $src
getImageService()  : ImageService
Return an instance of ImageService using object manager

Methods

initializeArguments()

Initialize arguments

public initializeArguments() : mixed

renderStatic()

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

public static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
$arguments : array<string|int, mixed>
$renderChildrenClosure : Closure
$renderingContext : RenderingContextInterface
Tags
throws
Exception
Return values
string

        
On this page

Search results