From 13f9d704ee34faffce657d411ae79b48393bbc4b Mon Sep 17 00:00:00 2001 From: Mogens Fiebrandt <mogens.fiebrandt@googlemail.com> Date: Wed, 22 May 2024 03:30:42 +0200 Subject: [PATCH] [BUGFIX] Handle processed file paths properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When implementing a custom ImageViewHelper to manipulate the image with the GifBuilder, after processing instructions has been applied, the processed image in the typo3temp/assets/images folder was a 1x1px sized image. This happened because the ContentObjectRenderer::getImgResource() returned null instead of an ImageResource, when the path of a processed file was passed as $file argument. It turned out, that the return of ResourceFactory::retrieveFileOrFolderObject() also can be an instance of ProcessedFile. So that the @return annotation had to be expanded by this class. The change in ContentObjectRenderer::getImgResource() now handles paths of processed files properly. Resolves: #103872 Releases: main Change-Id: Ie67b77b680a339054bcf99d522234cb1d10e2ca6 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84337 Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Benni Mack <benni@typo3.org> Tested-by: core-ci <typo3@b13.com> --- typo3/sysext/core/Classes/Resource/ResourceFactory.php | 2 +- .../frontend/Classes/ContentObject/ContentObjectRenderer.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php index 1c098ee757bc..fbfc521d58f2 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php +++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php @@ -272,7 +272,7 @@ class ResourceFactory implements SingletonInterface * - "file:23" * * @param string $input - * @return File|Folder|null + * @return ProcessedFile|File|Folder|null */ public function retrieveFileOrFolderObject($input) { diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 2e1272050ef9..4492ef1f6fab 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -3649,6 +3649,8 @@ class ContentObjectRenderer implements LoggerAwareInterface $imageResource = ImageResource::createFromProcessedFile($processedFileObject); } } + } elseif ($fileObject instanceof ProcessedFile) { + $imageResource = ImageResource::createFromProcessedFile($fileObject); } } -- GitLab