Neos.Media/Classes/ViewHelpers/ImageViewHelper.php
public function render(ImageInterface $image = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null, $quality = null, $format = null)
    {
        if ($image === null) {
            return '';
        }

        if ($preset) {
            $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async);
        } else {
            $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async, $quality, $format);
        }
        $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($image, $thumbnailConfiguration, $this->controllerContext->getRequest());

        if ($thumbnailData === null) {
            return '';
        }

        $this->tag->addAttribute('src', $thumbnailData['src']);

        if ($thumbnailData['width'] > 0 && $thumbnailData['height'] > 0) {
            $this->tag->addAttributes([
                'width' => $thumbnailData['width'],
                'height' => $thumbnailData['height']
            ]);
        }

        // alt argument must be set because it is required (see $this->initializeArguments())
        if ($this->arguments['alt'] === '') {
            // has to be added explicitly because empty strings won't be added as attributes in general (see parent::initialize())
            $this->tag->addAttribute('alt', '');
        }

        return $this->tag->render();
    }
public function render(ImageInterface $image = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null, $quality = null, $format = null)
    {
        if ($image === null) {
            return '';
        }

        if ($preset) {
            $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async);
        } else {
            $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async, $quality, $format);
        }
        $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($image, $thumbnailConfiguration, $this->controllerContext->getRequest());

        if ($thumbnailData === null) {
            return '';
        }

        $this->tag->addAttribute('src', $thumbnailData['src']);

        if ($thumbnailData['width'] > 0 && $thumbnailData['height'] > 0) {
            $this->tag->addAttributes([
                'width' => $thumbnailData['width'],
                'height' => $thumbnailData['height']
            ]);
        }

        // alt argument must be set because it is required (see $this->initializeArguments())
        if ($this->arguments['alt'] === '') {
            // has to be added explicitly because empty strings won't be added as attributes in general (see parent::initialize())
            $this->tag->addAttribute('alt', '');
        }

        return $this->tag->render();
    }
public function render ( ImageInterface $ image = null , $ width = null , $ maximumWidth = null , $ height = null , $ maximumHeight = null , $ allowCropping = false , $ allowUpScaling = false , $ async = false , $ preset = null , $ quality = null , $ format = null ) { if ( $ image === null ) { return '' ; } if ( $ preset ) { $ thumbnailConfiguration = $ this -> thumbnailService -> getThumbnailConfigurationForPreset ( $ preset , $ async ) ; } else { $ thumbnailConfiguration = new ThumbnailConfiguration ( $ width , $ maximumWidth , $ height , $ maximumHeight , $ allowCropping , $ allowUpScaling , $ async , $ quality , $ format ) ; } $ thumbnailData = $ this -> assetService -> getThumbnailUriAndSizeForAsset ( $ image , $ thumbnailConfiguration , $ this -> controllerContext -> getRequest ( ) ) ; if ( $ thumbnailData === null ) { return '' ; } $ this -> tag -> addAttribute ( 'src' , $ thumbnailData [ 'src' ] ) ; if ( $ thumbnailData [ 'width' ] > 0 && $ thumbnailData [ 'height' ] > 0 ) { $ this -> tag -> addAttributes ( [ 'width' => $ thumbnailData [ 'width' ] , 'height' => $ thumbnailData [ 'height' ] ] ) ; } // alt argument must be set because it is required (see $this->initializeArguments()) if ( $ this -> arguments [ 'alt' ] === '' ) { // has to be added explicitly because empty strings won't be added as attributes in general (see parent::initialize()) $ this -> tag -> addAttribute ( 'alt' , '' ) ; } return $ this -> tag -> render ( ) ; }
Renders an HTML img tag with a thumbnail image, created from a given image.

@param ImageInterface $image The image to be rendered as an image
@param integer $width Desired width of the image
@param integer $maximumWidth Desired maximum width of the image
@param integer $height Desired height of the image
@param integer $maximumHeight Desired maximum height of the image
@param boolean $allowCropping Whether the image should be cropped if the given sizes would hurt the aspect ratio
@param boolean $allowUpScaling Whether the resulting image size might exceed the size of the original image
@param boolean $async Return asynchronous image URI in case the requested image does not exist already
@param string $preset Preset used to determine image configuration
@param integer $quality Image quality, from 0 to 100
@param string $format Format for the image, jpg, jpeg, gif, png, wbmp, xbm, webp and bmp are supported
@return string an <img...> html tag
Renders an HTML img tag with a thumbnail image created from a given image .