TYPO3  7.6
Public Member Functions | Protected Attributes | List of all members
ImageViewHelper Class Reference
Inheritance diagram for ImageViewHelper:
AbstractTagBasedViewHelper AbstractViewHelper

Public Member Functions

 initializeArguments ()
 
 render ($src=null, $width=null, $height=null, $minWidth=null, $minHeight=null, $maxWidth=null, $maxHeight=null, $treatIdAsReference=false, $image=null, $crop=null, $absolute=false)
 
- Public Member Functions inherited from AbstractTagBasedViewHelper
 __construct ()
 
 initialize ()
 
- 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 ()
 

Protected Attributes

 $tagName = 'img'
 
 $imageService
 
- Protected Attributes inherited from AbstractTagBasedViewHelper
 $tag = null
 
 $tagName = 'div'
 
- Protected Attributes inherited from AbstractViewHelper
 $arguments
 
 $templateVariableContainer
 
 $controllerContext
 
 $renderingContext
 
 $renderChildrenClosure = null
 
 $viewHelperVariableContainer
 
 $objectManager
 
 $escapingInterceptorEnabled = true
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractViewHelper
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Protected Member Functions inherited from AbstractTagBasedViewHelper
 registerTagAttribute ($name, $type, $description, $required=false, $default=null)
 
 registerUniversalTagAttributes ()
 

Detailed Description

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

= Examples =

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

alt text

or (in BE mode):

alt text

</output>

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

alt set in image record

</output>

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

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

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

Member Function Documentation

initializeArguments ( )
render (   $src = null,
  $width = null,
  $height = null,
  $minWidth = null,
  $minHeight = null,
  $maxWidth = null,
  $maxHeight = null,
  $treatIdAsReference = false,
  $image = null,
  $crop = null,
  $absolute = false 
)

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

See Also
https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Image/
Parameters
string$srca path to a file, a combined FAL identifier or an uid (int). If $treatIdAsReference is set, the integer is considered the uid of the sys_file_reference record. If you already got a FAL object, consider using the $image parameter instead
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
FileInterface | AbstractFileFolder$imagea FAL object
string | bool$cropoverrule cropping of image (setting to FALSE disables the cropping set in FileReference)
bool$absoluteForce absolute URL
Exceptions
\TYPO3\CMS\Fluid\Core\ViewHelper\Exception
Returns
string Rendered tag

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

References FileReference\getProperty().

Member Data Documentation

$imageService
protected
$tagName = 'img'
protected