TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper:
TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface

Public Member Functions

 render ($src=null, $image=null, $width=null, $height=null, $minWidth=null, $minHeight=null, $maxWidth=null, $maxHeight=null, $treatIdAsReference=false, $crop=null, $absolute=false)
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 setArguments (array $arguments)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 isEscapingInterceptorEnabled ()
 
 setViewHelperNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node)
 
 setRenderChildrenClosure (\Closure $renderChildrenClosure)
 
 initializeArgumentsAndRender ()
 
 initialize ()
 
 renderChildren ()
 
 prepareArguments ()
 
 validateArguments ()
 
 initializeArguments ()
 
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode, \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
 resetState ()
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode, \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 

Static Public Member Functions

static renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
static renderStatic (array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
static renderStatic (array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 

Additional Inherited Members

- Protected Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 registerArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 overrideArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 callRenderMethod ()
 
 getLogger ()
 
 buildRenderChildrenClosure ()
 
 hasArgument ($argumentName)
 
- Protected Attributes inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 $arguments
 
 $templateVariableContainer
 
 $controllerContext
 
 $renderingContext
 
 $renderChildrenClosure = null
 
 $viewHelperVariableContainer
 
 $objectManager
 
 $escapingInterceptorEnabled = true
 

Detailed Description

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

= Examples =

<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 </output>

<f:uri.image image="{imageObject}" /> <output> fileadmin/images/image.png or (in BE mode): fileadmin/images/image.png </output>

{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) </output>

<f:uri.image src="NonExistingImage.png" /> <output> Could not get image resource for "NonExistingImage.png". </output>

Definition at line 67 of file ImageViewHelper.php.

Member Function Documentation

◆ render()

TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::render (   $src = null,
  $image = null,
  $width = null,
  $height = null,
  $minWidth = null,
  $minHeight = null,
  $maxWidth = null,
  $maxHeight = null,
  $treatIdAsReference = false,
  $crop = null,
  $absolute = false 
)

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

See also
https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/ImgResource/
Parameters
string$src
FileInterface | AbstractFileFolder$image
string$widthwidth 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$heightheight 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.
int$minWidthminimum width of the image
int$minHeightminimum height of the image
int$maxWidthmaximum width of the image
int$maxHeightmaximum height of the image
bool$treatIdAsReferencegiven src argument is a sys_file_reference record
string | bool$cropoverrule cropping of image (setting to FALSE disables the cropping set in FileReference)
bool$absoluteForce absolute URL
Exceptions
Exception
Returns
string path to the image

Definition at line 87 of file ImageViewHelper.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper\buildRenderChildrenClosure().

◆ renderStatic()

static TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper::renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static
Parameters
array$arguments
callable$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
string
Exceptions
Exception

Definition at line 115 of file ImageViewHelper.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper\$objectManager, TYPO3\CMS\Core\Resource\FileReference\getProperty(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().