From 8e35fd8078147eb9e1a06b8e251ee531a3f18798 Mon Sep 17 00:00:00 2001 From: Frans Saris <franssaris@gmail.com> Date: Sun, 19 Feb 2017 11:27:47 +0100 Subject: [PATCH] [BUGFIX] Use new cropping API for CE preview in the BE page module Resolves: #79854 Releases: master Change-Id: Ib7cc81efda1c59d54ab30af00622456955cf7397 Reviewed-on: https://review.typo3.org/51752 Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> --- typo3/sysext/backend/Classes/Utility/BackendUtility.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 9ca18500662c..3d30e6867e3f 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Database\RelationHandler; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection; use TYPO3\CMS\Core\Resource\AbstractFile; use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException; use TYPO3\CMS\Core\Resource\File; @@ -1666,12 +1667,14 @@ class BackendUtility $fileReferenceObject->getExtension() ) ) { + $cropVariantCollection = CropVariantCollection::create((string)$fileReferenceObject->getProperty('crop')); + $cropArea = $cropVariantCollection->getCropArea(); $processedImage = $fileObject->process( ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, [ 'width' => $sizeParts[0], 'height' => $sizeParts[1] . 'c', - 'crop' => $fileReferenceObject->getProperty('crop') + 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($fileReferenceObject) ] ); $imageUrl = $processedImage->getPublicUrl(true); -- GitLab