Breaking: #101955 - Removed public methods related to Image Generation¶
See forge#101955
Description¶
For historical reasons, there is a PHP API class
TYPO3\CMS\Core\Imaging\GraphicalFunctions
which deals with general
imaging functionality such as converting, scaling or cropping images - mainly
with ImageMagick / GraphicsMagick as a basis. In addition, the PHP class
TYPO3\CMS\Frontend\Imaging\GifBuilder
which works with instructions
originally built for use with TypoScript and image manipulation such as masking,
combining text with images based mainly on the PHP extension GDLib.
Even though TYPO3 works best having both GDLib and ImageMagick installed and properly configured, the inter-dependency within the TYPO3 Core API when to use what class has always been unclear - mostly because this functionality has not been cleaned up in the past 20 years.
For this reason, GifBuilder
now contains all functionality related to
GDLib, and all related methods from GraphicalFunctions have been removed.
GraphicalFunctions
thus is only contains ImageMagick/GraphicsMagick
functionality.
In addition, GifBuilder and GraphicalFunctions are now two separate classes without inheritance, but utilizes the Composition pattern.
The following public methods from GraphicalFunctions
have been removed:
TYPO3\CMS\Core\Imaging\GraphicalFunctions->adjust()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->applyImageMagickToPHPGif()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->applyOffset()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->autolevels()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->convertColor()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->copyImageOntoImage()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->crop()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->destroy()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->getTemporaryImageWithText()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->hexColor()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->imageCreateFromFile()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->ImageTTFBBoxWrapper()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->ImageTTFTextWrapper()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->ImageWrite()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->inputLevels()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeBox()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeEffect()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeEllipse()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeEmboss()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeOutline()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeShadow()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->makeText()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->maskImageOntoImage()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->output()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->outputLevels()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->scale()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->splitString()
TYPO3\CMS\Core\Imaging\GraphicalFunctions->unifyColors()
TYPO3\CMS\Core\Imaging\GraphicalFunctions::readPngGif()
The following public properties from GraphicalFunctions
have been removed:
TYPO3\CMS\Core\Imaging\GraphicalFunctions->colMap
TYPO3\CMS\Core\Imaging\GraphicalFunctions->h
TYPO3\CMS\Core\Imaging\GraphicalFunctions->map
TYPO3\CMS\Core\Imaging\GraphicalFunctions->saveAlphaLayer
TYPO3\CMS\Core\Imaging\GraphicalFunctions->setup
TYPO3\CMS\Core\Imaging\GraphicalFunctions->truecolorColors
TYPO3\CMS\Core\Imaging\GraphicalFunctions->w
TYPO3\CMS\Core\Imaging\GraphicalFunctions->workArea
The following public properties in GifBuilder
have been removed:
TYPO3\CMS\Frontend\Imaging\GifBuilder->charRangeMap
TYPO3\CMS\Frontend\Imaging\GifBuilder->myClassName
The following public properties in GifBuilder
are now marked as protected:
TYPO3\CMS\Frontend\Imaging\GifBuilder->charRangeMap
TYPO3\CMS\Frontend\Imaging\GifBuilder->combinedFileNames
TYPO3\CMS\Frontend\Imaging\GifBuilder->combinedTextStrings
TYPO3\CMS\Frontend\Imaging\GifBuilder->data
TYPO3\CMS\Frontend\Imaging\GifBuilder->defaultWorkArea
TYPO3\CMS\Frontend\Imaging\GifBuilder->objBB
TYPO3\CMS\Frontend\Imaging\GifBuilder->XY
Impact¶
When using the classes directly in PHP code of extensions, calling any of the methods or accessing / setting the affected properties will result in a PHP error.
Affected installations¶
TYPO3 installations with custom extensions utilizing the PHP API of these two classes directly.
For any usages of these classes via TypoScript or the File Abstraction Layer API will continue to work and are not affected by this breaking change.
Migration¶
Use static analysis tools such as PHPStan or Psalm to detect if PHP code of custom extensions is affected, and make use of GifBuilder class instead of GraphicalFunctions when needing GDLib functionality.