[BUGFIX] Use new cropping API for CE preview in the BE page module 52/51752/2
authorFrans Saris <franssaris@gmail.com>
Sun, 19 Feb 2017 10:27:47 +0000 (11:27 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 20 Feb 2017 08:02:32 +0000 (09:02 +0100)
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

index 9ca1850..3d30e68 100644 (file)
@@ -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);