From 2f9cf149dcb294db17c0ef0ea108f0b54762417c Mon Sep 17 00:00:00 2001 From: Tymoteusz Motylewski <t.motylewski@gmail.com> Date: Mon, 27 Nov 2017 22:09:52 +0100 Subject: [PATCH] [BUGFIX] Do not reprocess image preview when empty configuration is passed Fixes regression introduced in https://review.typo3.org/53399 Where thumbnail was regenerated every time process was called with empty configuration like: $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, []) Resolves: #83242 Relates: #81776 Releases: master, 8.7, 7.6 Change-Id: I6a4c331bad4d80225d3914f1a48f6071b0d87380 Reviewed-on: https://review.typo3.org/54804 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Reviewed-by: Frans Saris <franssaris@gmail.com> Tested-by: Frans Saris <franssaris@gmail.com> --- typo3/sysext/core/Classes/Resource/File.php | 6 ++++++ typo3/sysext/core/Classes/Resource/ProcessedFile.php | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/core/Classes/Resource/File.php b/typo3/sysext/core/Classes/Resource/File.php index 3e9316db5f22..b03f600afffe 100644 --- a/typo3/sysext/core/Classes/Resource/File.php +++ b/typo3/sysext/core/Classes/Resource/File.php @@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Resource; */ use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Core\Utility\MathUtility; /** * File representation in the file abstraction layer. @@ -296,6 +297,11 @@ class File extends AbstractFile */ public function process($taskType, array $configuration) { + if ($taskType === ProcessedFile::CONTEXT_IMAGEPREVIEW) { + $configuration = array_merge(['width' => 64, 'height' => 64], $configuration); + $configuration['width'] = MathUtility::forceIntegerInRange($configuration['width'], 1, 1000); + $configuration['height'] = MathUtility::forceIntegerInRange($configuration['height'], 1, 1000); + } return $this->getStorage()->processFile($this, $taskType, $configuration); } diff --git a/typo3/sysext/core/Classes/Resource/ProcessedFile.php b/typo3/sysext/core/Classes/Resource/ProcessedFile.php index 1e4cc9007e4d..b97fd110fc05 100644 --- a/typo3/sysext/core/Classes/Resource/ProcessedFile.php +++ b/typo3/sysext/core/Classes/Resource/ProcessedFile.php @@ -118,11 +118,6 @@ class ProcessedFile extends AbstractFile $this->originalFileSha1 = $this->originalFile->getSha1(); $this->storage = $originalFile->getStorage()->getProcessingFolder()->getStorage(); $this->taskType = $taskType; - if ($taskType === self::CONTEXT_IMAGEPREVIEW) { - $processingConfiguration = array_merge(['width' => 64, 'height' => 64], $processingConfiguration); - $processingConfiguration['width'] = MathUtility::forceIntegerInRange($processingConfiguration['width'], 1, 1000); - $processingConfiguration['height'] = MathUtility::forceIntegerInRange($processingConfiguration['height'], 1, 1000); - } $this->processingConfiguration = $processingConfiguration; if (is_array($databaseRow)) { $this->reconstituteFromDatabaseRecord($databaseRow); -- GitLab