TYPO3  7.6
Public Member Functions | Static Public Member Functions | List of all members
ImageViewHelper Class Reference
Inheritance diagram for ImageViewHelper:
AbstractViewHelper 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 AbstractViewHelper
 setArguments (array $arguments)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 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 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 AbstractViewHelper
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from CompilableInterface
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 

Additional Inherited Members

- Protected Member Functions inherited from 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 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 66 of file fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php.

Member Function Documentation

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 86 of file fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php.

References AbstractViewHelper\buildRenderChildrenClosure().

static renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static
Parameters
array$arguments
callable$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
string
Exceptions
Exception

Definition at line 114 of file fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php.

References FileReference\getProperty().