Documentation · ViewHelper reference

Uri / ImageViewHelper


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

Examples

Default

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

Output

typo3conf/ext/myext/Resources/Public/typo3_logo.png
or (in BE mode): ../typo3conf/ext/myext/Resources/Public/typo3_logo.png

Image Object

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

Output

fileadmin/images/image.png
or (in BE mode):
fileadmin/images/image.png

Inline notation

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

Output

typo3temp/pics/[b4c0e7ed5c].png
(depending on your TYPO3s encryption key)

non existing image

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

Output

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

/
  • Tag usage example

    <f:uri.image src="NULL" image="[anySimpleType]" width="NULL" height="NULL" minWidth="123" minHeight="123" maxWidth="123" maxHeight="123" treatIdAsReference="1" crop="[anySimpleType]" absolute="1">
    	<!-- tag content - may be ignored! -->
    </f:uri.image>
  • Inline usage example

    {f:uri.image(src: 'NULL', image: [anySimpleType], width: 'NULL', height: 'NULL', minWidth: 123, minHeight: 123, maxWidth: 123, maxHeight: 123, treatIdAsReference: 1, crop: [anySimpleType], absolute: 1)}

Arguments

Argument Description Type
absolute

Force absolute URL

boolean
crop

overrule cropping of image (setting to FALSE disables the cropping set in FileReference)

anySimpleType
height

height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.

string
image anySimpleType
maxHeight

maximum height of the image

integer
maxWidth

maximum width of the image

integer
minHeight

minimum height of the image

integer
minWidth

minimum width of the image

integer
src string
treatIdAsReference

given src argument is a sysfilereference record

boolean
width

width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.

string
Required attribute

Revision history

commit ad650e0447d20c24256935e1d0cd192c495a766d
Author: Bjoern Fromme <*****@bjo3rn.com>
Date:   Wed Jan 30 09:35:59 2013 +0100

    [FEATURE] Add media related base VHs, add image related VH, add video VH

commit 86b105c6771d22fe9a43eb49c53bf70636067012
Author: Bjoern Fromme <*****@bjo3rn.com>
Date:   Wed Jan 30 09:40:02 2013 +0100

    [TASK] Move image and video VHs to ViewHelpers\Media subpackage

commit 49e420d2ea1ed07923a3e256a6a152b41c306869
Author: Claus Due <*****@wildside.dk>
Date:   Fri Feb 1 10:36:57 2013 +0100

    [TASK] Make src argument global for all media related VHs and allow array or Traversable objects

commit 4926809a7b528faddd4b9fa575bda5955601beed
Author: Claus Due <*****@wildside.dk>
Date:   Fri Feb 1 10:47:31 2013 +0100

    [TASK] Refactor Media / AbstractImage to Media / Image / AbstractImage

commit c89e47466c5e7d55438dbb004cc7dbfaf439db74
Author: Claus Due <*****@wildside.dk>
Date:   Sat Mar 2 19:00:23 2013 +0100

    [DOC] Doc comment for Uri / Image VIewHelper

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 4981055359c895f3869e5bd878293b3c15ed26e5
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 14:01:04 2015 +0100

    [TASK] CGL - Define classes, params, use imports

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file