From f7cafe6e962a1360cb790909e4b30f4fa12990c7 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/55040 Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> --- 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 a3560f5a25d8..153a94ee3b6c 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. @@ -301,6 +302,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 8a494b7a0cb5..8268e009ab17 100644 --- a/typo3/sysext/core/Classes/Resource/ProcessedFile.php +++ b/typo3/sysext/core/Classes/Resource/ProcessedFile.php @@ -117,11 +117,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