Skip to content
Snippets Groups Projects
Commit 2f9cf149 authored by Tymoteusz Motylewski's avatar Tymoteusz Motylewski Committed by Frans Saris
Browse files

[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: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: default avatarFrans Saris <franssaris@gmail.com>
Tested-by: default avatarFrans Saris <franssaris@gmail.com>
parent 34cf1789
No related merge requests found
...@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Resource; ...@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Resource;
*/ */
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
/** /**
* File representation in the file abstraction layer. * File representation in the file abstraction layer.
...@@ -296,6 +297,11 @@ class File extends AbstractFile ...@@ -296,6 +297,11 @@ class File extends AbstractFile
*/ */
public function process($taskType, array $configuration) 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); return $this->getStorage()->processFile($this, $taskType, $configuration);
} }
......
...@@ -118,11 +118,6 @@ class ProcessedFile extends AbstractFile ...@@ -118,11 +118,6 @@ class ProcessedFile extends AbstractFile
$this->originalFileSha1 = $this->originalFile->getSha1(); $this->originalFileSha1 = $this->originalFile->getSha1();
$this->storage = $originalFile->getStorage()->getProcessingFolder()->getStorage(); $this->storage = $originalFile->getStorage()->getProcessingFolder()->getStorage();
$this->taskType = $taskType; $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; $this->processingConfiguration = $processingConfiguration;
if (is_array($databaseRow)) { if (is_array($databaseRow)) {
$this->reconstituteFromDatabaseRecord($databaseRow); $this->reconstituteFromDatabaseRecord($databaseRow);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment