Bug #106758
openGIFBUILDER: using "SCALE" function leads to exception
0%
Description
Using the "SCALE" object of the GIFBUILDER results in the following exception:
TYPO3\CMS\Core\Imaging\ImageProcessingResult::getRealPath(): Return value must be of type string, false returned
We use the GIFBUILDER in a custom ViewHelper using the "GifBuilder" class and it's gifBuild() function (after calling it's start() function of course).
The "SCALE" object is the last (see attached screenshot of the PHP variable given to the GifBuilder).
Removing the "SCALE" object from the configuration creates the image without any problem.
Extract from the call stack leading to Exception:
(1/1) TypeError
TYPO3\CMS\Core\Imaging\ImageProcessingResult::getRealPath(): Return value must be of type string, false returned
------------------------------------------------------
in <PATH_TO_TYPO3_INSTALLATION>/vendor/typo3/cms-core/Classes/Imaging/ImageProcessingResult.php line 55
}
public function getRealPath(): string
{
return $this->getImageInfoObject()->getRealPath();
}
/**
* @return int<0, max>
------------------------------------------------------
at TYPO3\CMS\Core\Imaging\ImageProcessingResult->getRealPath()
in <PATH_TO_TYPO3_INSTALLATION>/vendor/typo3/cms-frontend/Classes/Imaging/GifBuilder.php line 1191
// Clears workArea to total image
$this->setWorkArea('');
}
unlink($theFile);
if ($theNewFile->getRealPath() !== $theFile) {
unlink($theNewFile->getRealPath());
}
}
}
------------------------------------------------------
at TYPO3\CMS\Frontend\Imaging\GifBuilder->scale()
in <PATH_TO_TYPO3_INSTALLATION>/vendor/typo3/cms-frontend/Classes/Imaging/GifBuilder.php line 624
case 'CROP':
$this->crop($im, $conf);
break;
case 'SCALE':
$this->scale($im, $conf);
break;
case 'WORKAREA':
if ($conf['set']) {
// this sets the workArea
------------------------------------------------------
Files
Updated by Garvin Hicking 27 days ago
- Status changed from New to Needs Feedback
I wonder, are you passing a processed file back again into the gifbuilder? Or how is this webp image fed into your structure?
Theoretically you could bypass the error by patching
public function getRealPath(): string { return $this->getImageInfoObject()->getRealPath(); }
to
public function getRealPath(): string { return (string)$this->getImageInfoObject()->getRealPath(); }
but I think that would only be symptomatic, and in reality there could be a problem of stacking further file processing onto a processed file object that got removed/deleted already (hence the 'false' for its lookup).
Maybe you could produce an extension or some other example code to easily reproduce this?
Updated by Stefan Wagler 9 days ago
Garvin Hicking wrote in #note-1:
I wonder, are you passing a processed file back again into the gifbuilder? Or how is this webp image fed into your structure?
Theoretically you could bypass the error by patching
[...]
to
[...]
but I think that would only be symptomatic, and in reality there could be a problem of stacking further file processing onto a processed file object that got removed/deleted already (hence the 'false' for its lookup).
Yes, I have used a processed image as a source for the GIFBUILDER.
Patching TYPO3 core functions is not the way to go. So, either it is a bug within TYPO3, where nobody thought about the GifBuilder being used in such a way and the bug should be fixed, or the GifBuilder should just not be used in such a way. If the latter is the case, then there should be a small hint somewhere in the documentation ...
In the meantime I have changed my ViewHelper, so that the actual image processing is now done within a custom "FileProcessor", which acts as an alternative for the default TYPO3 "LocalImageProcessor": First the image is cropped and resized using the "GraphicalFunctions"'s "resize" function and afterwards that image is handled by the GifBuilder. Now, I no longer use the "SCALE" function of the GifBuilder.
For background, please see also post "Using event "AfterFileProcessingEvent" or ViewHelper to replace a ProcessedImage file" on Slack channel "typo3-cms" from June 4th 2025.
Updated by Stefan Wagler 9 days ago
Garvin Hicking wrote in #note-1:
but I think that would only be symptomatic, and in reality there could be a problem of stacking further file processing onto a processed file object that got removed/deleted already (hence the 'false' for its lookup).
Btw: The idea to use a processed image as a source for the GifBuilder was this german speaking article:
https://www.marc-willmann.de/typo3-cms/typo3-image-viewhelper-mit-gifbuilder-funktionalitaet
So, I bet that I'm not the only one using this approach, which works but not when using "SCALE" ...
Updated by Garvin Hicking 9 days ago
Theoretically you could bypass the error by patching
Patching TYPO3 core functions is not the way to go.
I may have not expressed myself properly.
I was kindly asking for your help to see if patching it like this removes the error and computes everything properly. If so, such a fix could find its way into the TYPO3 core.