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

Public Member Functions

 injectImageService (\TYPO3\CMS\Extbase\Service\ImageService $imageService)
 
 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 TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
 __construct ()
 
 initialize ()
 
- 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 ()
 

Protected Attributes

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

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
 registerTagAttribute ($name, $type, $description, $required=false, $default=null)
 
 registerUniversalTagAttributes ()
 
- 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)
 

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="fileadmin/user_upload/example.pdf" alt="foo" /> <output> If your graphics processing library is set up correctly then it will output a thumbnail of the first page of your PDF document.

foo

</output>

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

Definition at line 66 of file ImageViewHelper.php.

Member Function Documentation

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::initializeArguments ( )

◆ injectImageService()

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::injectImageService ( \TYPO3\CMS\Extbase\Service\ImageService  $imageService)
Parameters
\TYPO3\CMS\Extbase\Service\ImageService$imageService

Definition at line 81 of file ImageViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper\$imageService.

◆ render()

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::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

Definition at line 120 of file ImageViewHelper.php.

References TYPO3\CMS\Core\Resource\FileReference\getProperty().

Member Data Documentation

◆ $imageService

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::$imageService
protected

◆ $tagName

TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper::$tagName = 'img'
protected

Definition at line 71 of file ImageViewHelper.php.