Issue Bug Closed

#81776Duplicated image thumbnails in file list, file picker and search

Tymoteusz Motylewski 07/03/17, 23:50 updated 10/02/18, 10:58

Description

TYPO3 shows image thumbnails in file list module, search in file list module and file picker.

Unfortunately all these places generate unique thumbnail, which pollutes the sys_file_processedfile table as well as filesystem.
Dimensions of the images are the same.

File list:
responsible file:
typo3/cms/typo3/sysext/filelist/Classes/FileList.php

$processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, [])

$thumbUrl = $processedFile->getPublicUrl(true);
$theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' .
   'width="' . $processedFile->getProperty('width') . '" ' .
   'height="' . $processedFile->getProperty('height') . '" ' .
   'title="' . htmlspecialchars($fileName) . '" alt="" />';

generates image like /fileadmin/_processed_/0/3/preview_1_861a55d585.jpg
with empty configuration column in db, and “Image.Preview” as task_type

Search in filelist
- uses fluid template typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html
<f:image image="{file.resource}" maxwidth="64" maxheight="43"></f:image>

result in file /fileadmin/_processed_/0/3/csm_1_461a7fe184.jpg
with configuration column in db like:

a:7:{s:5:"width";N;s:6:"height";N;s:8:"minWidth";N;s:9:"minHeight";N;s:8:"maxWidth";i:64;s:9:"maxHeight";i:43;s:4:"crop";N;}

task type: “Image.CropScaleMask”

file picker

responsible code: typo3/sysext/recordlist/Classes/Browser/FileBrowser.php

$processedFile = $fileObject->process(
    ProcessedFile::CONTEXT_IMAGEPREVIEW,
    ['width' => 64, 'height' => 64]
);
$imageUrl = $processedFile->getPublicUrl(true);
$imgInfo = [
    $fileObject->getProperty('width'),
    $fileObject->getProperty('height')
];
$clickIcon = '<img src="' . $imageUrl . '"'
    . '  width="' . $processedFile->getProperty('width') . '"'
    . ' height="' . $processedFile->getProperty('height') . '"'
    . ' hspace="5" vspace="5" border="1" />';

generates file like:
/fileadmin/_processed_/0/3/preview_1_dd144cea45.jpg

with configuration in db:

a:2:{s:5:"width";i:64;s:6:"height";i:64;}

“Image.Preview” as task_type

Reviews 6