Commit 1ee83458 authored by Helmut Hummel's avatar Helmut Hummel
Browse files

[BUGFIX] Properly render IRRE image thumbnail

Use IMAGECROPSCALEMASK to render IRRE thumbnails,
so that the crop area is properly respected and
the TCA configuration for the rendering is applied as well.

Also fix the resolving of the crop area, which remained
undiscovered, as the crop configuration is ignored
with IMAGEPREVIEW processing.

Releases: master, 10.4, 9.5
Resolves: #91978
Change-Id: Ia986bc4ec77ce06a9dacbced0b536462f19db1a3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65278

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarTim Schreiner <schreiner.tim@gmail.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Helmut Hummel's avatarHelmut Hummel <typo3@helhum.io>
Reviewed-by: default avatarSimon Praetorius <simon@praetorius.me>
Reviewed-by: default avatarTim Schreiner <schreiner.tim@gmail.com>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Helmut Hummel's avatarHelmut Hummel <typo3@helhum.io>
parent 0af73b7a
......@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory;
......@@ -370,13 +371,14 @@ class InlineRecordContainer extends AbstractContainer
} elseif ($fileObject) {
$imageSetup = $inlineConfig['appearance']['headerThumbnail'];
unset($imageSetup['field']);
if (!empty($rec['crop'])) {
$imageSetup['crop'] = $rec['crop'];
$cropVariantCollection = CropVariantCollection::create($rec['crop'] ?? '');
if (!$cropVariantCollection->getCropArea()->isEmpty()) {
$imageSetup['crop'] = $cropVariantCollection->getCropArea()->makeAbsoluteBasedOnFile($fileObject);
}
$imageSetup = array_merge(['width' => '45', 'height' => '45c'], $imageSetup);
$imageSetup = array_merge(['maxWidth' => '145', 'maxHeight' => '45'], $imageSetup);
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $fileObject->isImage()) {
$processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup);
$processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup);
// Only use a thumbnail if the processing process was successful by checking if image width is set
if ($processedImage->getProperty('width')) {
$imageUrl = $processedImage->getPublicUrl(true);
......
......@@ -589,8 +589,7 @@ class ExtensionManagementUtility
'useSortable' => true,
'headerThumbnail' => [
'field' => 'uid_local',
'width' => '45',
'height' => '45c',
'height' => '45m',
],
'enabledControls' => [
......
Markdown is supported
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