Skip to content
Snippets Groups Projects
Commit 755e0ed0 authored by Tymoteusz Motylewski's avatar Tymoteusz Motylewski Committed by Georg Ringer
Browse files

[BUGFIX] Don't duplicate thumbnails in file list and file selector

Default width and height for thumbnails is now applied in ProcessedFile
thus configuration column of the sys_file_processedfile table is filled
even if empty configuration was passed to File->Process().

This prevents thumbnails with the same content but different names being
generated, thus improves performance.

Resolves: #81776
Releases: master, 8.7, 7.6
Change-Id: Ie001e3d6404b52c251d9ed24bcac461ed75050b8
Reviewed-on: https://review.typo3.org/53399


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarFrans Saris <franssaris@gmail.com>
Tested-by: default avatarFrans Saris <franssaris@gmail.com>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent e87ebbd6
Branches
Tags
No related merge requests found
......@@ -24,7 +24,6 @@ use TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor;
use TYPO3\CMS\Core\Resource\Service\FileProcessingService;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Frontend\Imaging\GifBuilder;
/**
......@@ -79,12 +78,9 @@ class PreviewProcessing
return;
}
$temporaryFileNameForResizedThumb = uniqid(PATH_site . 'typo3temp/var/transient/online_media_' . $file->getHashedIdentifier()) . '.jpg';
$configuration = $processedFile->getProcessingConfiguration();
switch ($taskType) {
case ProcessedFile::CONTEXT_IMAGEPREVIEW:
// Merge custom configuration with default configuration
$configuration = array_merge(['width' => 64, 'height' => 64], $configuration);
$configuration['width'] = MathUtility::forceIntegerInRange($configuration['width'], 1, 1000);
$configuration['height'] = MathUtility::forceIntegerInRange($configuration['height'], 1, 1000);
$this->resizeImage($temporaryFileName, $temporaryFileNameForResizedThumb, $configuration);
break;
......
......@@ -118,6 +118,11 @@ 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);
......
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