[BUGFIX] Regression when scaling/cropping in GIFBUILDER 83/37483/6
authorTorben Hansen <derhansen@gmail.com>
Tue, 3 Mar 2015 08:34:41 +0000 (09:34 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 4 Mar 2015 18:26:17 +0000 (19:26 +0100)
The fix for issue #64224 introduced a regression in GIFBUILDER
resulting in problems with image scaling/cropping.

For $fileInfo and $maskInfo: use 'processedFile' for FAL files
if available and correctly distinguish between FAL- and non-FAL files
otherwise by checking for 'origFile'.

Resolves: #65378
Related: #64224
Releases: master, 6.2
Change-Id: Ib472bdcdc7f814e50ebd18e084f5fbe7d09fc410
Reviewed-on: http://review.typo3.org/37483
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Tested-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Christoph Lehmann <christoph.lehmann@networkteam.com>
Tested-by: Philipp Mueller <philipp.mueller@lavitto.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php

index 4689d1e..2a66017 100644 (file)
@@ -217,9 +217,14 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                                                        $fileInfo = $this->getResource($conf['file'], $conf['file.']);
                                                        if ($fileInfo) {
                                                                $this->combinedFileNames[] = preg_replace('/\\.[[:alnum:]]+$/', '', basename($fileInfo[3]));
-                                                               if ($fileInfo['originalFile'] instanceof \TYPO3\CMS\Core\Resource\File) {
+                                                               if ($fileInfo['processedFile'] instanceof \TYPO3\CMS\Core\Resource\ProcessedFile) {
+                                                                       // Use processed file, if a FAL file has been processed by GIFBUILDER (e.g. scaled/cropped)
+                                                                       $this->setup[$theKey . '.']['file'] = $fileInfo['processedFile']->getForLocalProcessing(FALSE);
+                                                               } elseif (!isset($fileInfo['origFile']) && $fileInfo['originalFile'] instanceof \TYPO3\CMS\Core\Resource\File) {
+                                                                       // Use FAL file with getForLocalProcessing to circumvent problems with umlauts, if it is a FAL file (origFile not set)
                                                                        $this->setup[$theKey . '.']['file'] = $fileInfo['originalFile']->getForLocalProcessing(FALSE);
                                                                } else {
+                                                                       // Use normal path from fileInfo if it is a non-FAL file (even non-FAL files have originalFile set, but only non-FAL files have origFile set)
                                                                        $this->setup[$theKey . '.']['file'] = $fileInfo[3];
                                                                }
                                                                $this->setup[$theKey . '.']['BBOX'] = $fileInfo;
@@ -227,7 +232,10 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
                                                                if ($conf['mask']) {
                                                                        $maskInfo = $this->getResource($conf['mask'], $conf['mask.']);
                                                                        if ($maskInfo) {
-                                                                               if ($maskInfo['originalFile'] instanceof \TYPO3\CMS\Core\Resource\File) {
+                                                                               // the same selection criteria as regarding fileInfo above apply here
+                                                                               if ($maskInfo['processedFile'] instanceof \TYPO3\CMS\Core\Resource\ProcessedFile) {
+                                                                                       $this->setup[$theKey . '.']['mask'] = $maskInfo['processedFile']->getForLocalProcessing(FALSE);
+                                                                               } elseif (!isset($maskInfo['origFile']) && $maskInfo['originalFile'] instanceof \TYPO3\CMS\Core\Resource\File) {
                                                                                        $this->setup[$theKey . '.']['mask'] = $maskInfo['originalFile']->getForLocalProcessing(FALSE);
                                                                                } else {
                                                                                        $this->setup[$theKey . '.']['mask'] = $maskInfo[3];