diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php index e5d0681ae371cf778823b9c01781d6214a2169e5..c6f8f5e8aae1b893c4b2624cc080b5e4ef5c43c4 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Fluid\ViewHelpers; use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection; use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException; -use TYPO3\CMS\Core\Resource\FileReference; /** * Resizes a given image (if required) and renders the respective img tag @@ -133,6 +132,7 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV } $cropVariantCollection = CropVariantCollection::create((string)$cropString); $cropVariant = $this->arguments['cropVariant'] ?: 'default'; + $cropArea = $cropVariantCollection->getCropArea($cropVariant); $processingInstructions = [ 'width' => $this->arguments['width'], 'height' => $this->arguments['height'], @@ -140,7 +140,7 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV 'minHeight' => $this->arguments['minHeight'], 'maxWidth' => $this->arguments['maxWidth'], 'maxHeight' => $this->arguments['maxHeight'], - 'crop' => $cropVariantCollection->getCropArea($cropVariant)->makeAbsoluteBasedOnFile($image), + 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image), ]; $processedImage = $this->imageService->applyProcessingInstructions($image, $processingInstructions); $imageUri = $this->imageService->getImageUri($processedImage, $this->arguments['absolute']); diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php index 45c7027ce51660999412c4dc5faa3c408d99f081..6bfaaad3b3d55cdff8db89750fbb6c82e04f762c 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php @@ -122,10 +122,11 @@ class MediaViewHelper extends AbstractTagBasedViewHelper $cropVariant = $this->arguments['cropVariant'] ?: 'default'; $cropString = $image instanceof FileReference ? $image->getProperty('crop') : ''; $cropVariantCollection = CropVariantCollection::create((string)$cropString); + $cropArea = $cropVariantCollection->getCropArea($cropVariant); $processingInstructions = [ 'width' => $width, 'height' => $height, - 'crop' => $cropVariantCollection->getCropArea($cropVariant)->makeAbsoluteBasedOnFile($image), + 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image), ]; $imageService = $this->getImageService(); $processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions); diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php index b32c553da4077a22fc589e1e27596b56f36282b4..a95766de4d544fca42acb3311d97eac5244a43d7 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ImageViewHelper.php @@ -16,7 +16,6 @@ namespace TYPO3\CMS\Fluid\ViewHelpers\Uri; use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection; use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException; -use TYPO3\CMS\Core\Resource\FileReference; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Service\ImageService; @@ -119,6 +118,7 @@ class ImageViewHelper extends AbstractViewHelper $cropVariantCollection = CropVariantCollection::create((string)$cropString); $cropVariant = $arguments['cropVariant'] ?: 'default'; + $cropArea = $cropVariantCollection->getCropArea($cropVariant); $processingInstructions = [ 'width' => $arguments['width'], 'height' => $arguments['height'], @@ -126,7 +126,7 @@ class ImageViewHelper extends AbstractViewHelper 'minHeight' => $arguments['minHeight'], 'maxWidth' => $arguments['maxWidth'], 'maxHeight' => $arguments['maxHeight'], - 'crop' => $cropVariantCollection->getCropArea($cropVariant)->makeAbsoluteBasedOnFile($image), + 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image), ]; $processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions);