From ef5f6cc8ee556c66caf8787635ef049a68e88006 Mon Sep 17 00:00:00 2001 From: Torben Hansen <derhansen@gmail.com> Date: Tue, 3 Mar 2015 09:34:41 +0100 Subject: [PATCH] [BUGFIX] Regression when scaling/cropping in GIFBUILDER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php index 4689d1ed82a5..2a6601702504 100644 --- a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php +++ b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php @@ -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]; -- GitLab