diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php index 42cd805f4c66571660d3b240fc2ed85b64a306d5..16a36d45db9e7c28476749cf3a2c601366097b6f 100644 --- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php +++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php @@ -2178,7 +2178,6 @@ class GraphicalFunctions $info = $this->getImageDimensions($info[3]); } if ($info[2] == $this->gifExtension && !$this->dontCompress) { - // Compress with IM (lzw) or GD (rle) (Workaround for the absence of lzw-compression in GD) self::gifCompress($info[3], ''); } return $info; @@ -2538,12 +2537,12 @@ class GraphicalFunctions } /** - * Compressing a GIF file if not already LZW compressed. + * Compressing a GIF file if not already compressed. * This function is a workaround for the fact that ImageMagick and/or GD does not compress GIF-files to their minimum size (that is RLE or no compression used) * * The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file * GIF: - * If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!) + * If $type is not set, the compression is done with ImageMagick * If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively * PNG: * No changes. @@ -2562,7 +2561,7 @@ class GraphicalFunctions return ''; } - if (($type === 'IM' || !$type) && $gfxConf['processor_enabled'] && $gfxConf['processor_path_lzw']) { + if (($type === 'IM' || !$type) && $gfxConf['processor_enabled']) { // Use temporary file to prevent problems with read and write lock on same file on network file systems $temporaryName = PathUtility::dirname($theFile) . '/' . md5(StringUtility::getUniqueId()) . '.gif'; // Rename could fail, if a simultaneous thread is currently working on the same thing @@ -2570,7 +2569,7 @@ class GraphicalFunctions $cmd = CommandUtility::imageMagickCommand( 'convert', ImageMagickFile::fromFilePath($temporaryName) . ' ' . CommandUtility::escapeShellArgument($theFile), - $gfxConf['processor_path_lzw'] + $gfxConf['processor_path'] ); CommandUtility::exec($cmd); unlink($temporaryName); diff --git a/typo3/sysext/core/Classes/Utility/CommandUtility.php b/typo3/sysext/core/Classes/Utility/CommandUtility.php index 05143771eb1ef30ee786ca8aac14622160287a51..2ff92266b891c98cd5a5037a87a04ee08f96272b 100644 --- a/typo3/sysext/core/Classes/Utility/CommandUtility.php +++ b/typo3/sysext/core/Classes/Utility/CommandUtility.php @@ -39,7 +39,7 @@ use TYPO3\CMS\Core\Core\Environment; * checkCommand() returns TRUE if a command is available * * Search paths that are included: - * $TYPO3_CONF_VARS['GFX']['processor_path_lzw'] or $TYPO3_CONF_VARS['GFX']['processor_path'] + * $TYPO3_CONF_VARS['GFX']['processor_path'] * $TYPO3_CONF_VARS['SYS']['binPath'] * $GLOBALS['_SERVER']['PATH'] * '/usr/bin/,/usr/local/bin/' on Unix @@ -377,8 +377,7 @@ class CommandUtility $sysPathArr = []; // Image magick paths first - // processor_path_lzw take precedence over processor_path - if ($imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw'] ?: $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']) { + if ($imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']) { $imPath = self::fixPath($imPath); $pathsArr[$imPath] = $imPath; } diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 961afa75f413ca4b1e05dd5d2ddd27d4b836d2e8..2e268d95e3ac35f4238de8210166028d9a6f59c1 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -31,7 +31,6 @@ return [ 'gdlib_png' => false, 'processor_enabled' => true, 'processor_path' => '/usr/bin/', - 'processor_path_lzw' => '/usr/bin/', 'processor' => 'ImageMagick', 'processor_effects' => false, 'processor_allowUpscaling' => true, diff --git a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml index ee33578de62ba6eaa47fd73e4cca889bb5162578..845b701aab6d39539c0e9dba030d3d53878e8f9b 100644 --- a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml +++ b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml @@ -26,9 +26,6 @@ GFX: processor_path: type: text description: 'Path to the IM tools ''convert'', ''combine'', ''identify''.' - processor_path_lzw: - type: text - description: 'Path to the IM tool ''convert'' with LZW enabled! See ''gif_compress''. If your version 4.2.9 of ImageMagick is compiled with LZW you may leave this field blank AND disable the flag ''gif_compress''! Tip: You can call LZW ''convert'' with a prefix like ''myver_convert'' by setting this path with it, eg. <code>/usr/bin/myver_</code> instead of just <code>/usr/bin/</code>.' processor: type: dropdown allowedValues: diff --git a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-97797-GFXSettingProcessor_path_lzwRemoved.rst b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-97797-GFXSettingProcessor_path_lzwRemoved.rst new file mode 100644 index 0000000000000000000000000000000000000000..10da1a614e446dbda3ecb2fd3ab7be775239f8ea --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-97797-GFXSettingProcessor_path_lzwRemoved.rst @@ -0,0 +1,54 @@ +.. include:: /Includes.rst.txt + +.. _breaking-97797-1655730428: + +========================================================= +Breaking: #97797 - GFX setting processor_path_lzw removed +========================================================= + +See :issue:`97797` + +Description +=========== + +The global configuration option :php:`$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw']` +which was used to compress GIF and TIFF files with a different ImageMagick version, +as LZW compression was removed from the distributed ImageMagick binaries back in +2004-2006. + +Since then, both GIF and TIFF have had reduced impact on the web we know today. + +For this reason, the value is removed. If GIF compression via LZW is wanted, +it should be pointing to the main `processor_path` setting. + + +Impact +====== + +Compression via LZW for GIF files is now only applied when the corresponding +ImageMagick version, found in `processor_path` is supporting LZW compression. + +The GFX setting `processor_path_lzw` is not used anymore, and can safely be +removed. When accessing the Install Tool, the setting is automatically removed +from :file:`LocalConfiguration.php`. + + +Affected installations +====================== + +TYPO3 installations actively using GIF compression or GIF thumbnails over PNG +thumbnails (if `GFX/thumbnails_png` is set to false), which might result in +GIF files with a larger file size. + + +Migration +========= + +It is recommended to switch to PNG thumbnails (TYPO3 setting `GFX/thumbnails_png`), +or use a ImageMagick version supporting LZW compression for GIF files, if this +functionality is explicitly needed. + +In addition, solutions such as `gifsicle` can be used instead to optimize +GIF images. + +.. index:: Frontend, PartiallyScanned, ext:core diff --git a/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php b/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php index 2d34eff87f7f4681e6714b3d9d5725f5ec5d3a40..887c059a03a7bb45a49c9cb6c72d9f4acfbdc408 100644 --- a/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php +++ b/typo3/sysext/install/Classes/Configuration/Image/AbstractImagePreset.php @@ -56,7 +56,7 @@ abstract class AbstractImagePreset extends AbstractPreset /** * Check is preset is currently active on the system. - * Overwrites parent method to ignore processor_path and processor_path_lzw settings + * Overwrites parent method to ignore processor_path setting * * @return bool TRUE if preset is active */ @@ -64,9 +64,7 @@ abstract class AbstractImagePreset extends AbstractPreset { $isActive = true; foreach ($this->configurationValues as $configurationKey => $configurationValue) { - if ($configurationKey !== 'GFX/processor_path' - && $configurationKey !== 'GFX/processor_path_lzw' - ) { + if ($configurationKey !== 'GFX/processor_path') { $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); if ($currentValue !== $configurationValue) { $isActive = false; @@ -98,7 +96,6 @@ abstract class AbstractImagePreset extends AbstractPreset $this->findExecutableInPath($this->getSearchPaths()); $configurationValues = $this->configurationValues; $configurationValues['GFX/processor_path'] = $this->getFoundPath(); - $configurationValues['GFX/processor_path_lzw'] = $this->getFoundPath(); return $configurationValues; } @@ -126,13 +123,6 @@ abstract class AbstractImagePreset extends AbstractPreset array_unshift($searchPaths, $path); } - // Add configured processor_path_lzw on top - $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path_lzw']; - if ((string)$imLzwSearchPath !== '' && !in_array($imLzwSearchPath, $searchPaths)) { - $path = $this->cleanUpPath($imLzwSearchPath); - array_unshift($searchPaths, $path); - } - // Add additional search path from form if given if (isset($this->postValues['additionalSearchPath']) && (string)$this->postValues['additionalSearchPath'] !== '' diff --git a/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php b/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php index fe4b1f39d2ba85508256687907a72394fa211f70..67f3eeddb10bf2103bebeaf26d24c7223c6ac6a1 100644 --- a/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php +++ b/typo3/sysext/install/Classes/Configuration/Image/CustomPreset.php @@ -30,7 +30,6 @@ class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface protected $configurationValues = [ 'GFX/processor_enabled' => false, 'GFX/processor_path' => '', - 'GFX/processor_path_lzw' => '', 'GFX/processor' => '', 'GFX/processor_effects' => false, 'GFX/processor_allowTemporaryMasksAsPng' => true, diff --git a/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php b/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php index 909bff757a930cd1b96f574035467a096cfafdb4..5230e6cf40b192a44f6a2ac549cb3ce5e78151b1 100644 --- a/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php +++ b/typo3/sysext/install/Classes/Configuration/Image/GraphicsMagickPreset.php @@ -39,9 +39,8 @@ class GraphicsMagickPreset extends AbstractImagePreset */ protected $configurationValues = [ 'GFX/processor_enabled' => true, - // processor_path and processor_path_lzw are determined and set by path lookup methods + // processor_path is determined and set by path lookup methods 'GFX/processor_path' => '', - 'GFX/processor_path_lzw' => '', 'GFX/processor' => 'GraphicsMagick', 'GFX/processor_effects' => false, 'GFX/processor_allowTemporaryMasksAsPng' => false, diff --git a/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php b/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php index 040be8cf5122781f3ff0f59f98cf85181fbea393..c36668ddad49b80b32fb71af808fc9ec1f17aa43 100644 --- a/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php +++ b/typo3/sysext/install/Classes/Configuration/Image/ImageMagick6Preset.php @@ -39,9 +39,8 @@ class ImageMagick6Preset extends AbstractImagePreset */ protected $configurationValues = [ 'GFX/processor_enabled' => true, - // processor_path and processor_path_lzw are determined and set by path lookup methods + // processor_path is determined and set by path lookup methods 'GFX/processor_path' => '', - 'GFX/processor_path_lzw' => '', 'GFX/processor' => 'ImageMagick', 'GFX/processor_effects' => true, 'GFX/processor_allowTemporaryMasksAsPng' => false, diff --git a/typo3/sysext/install/Classes/Controller/EnvironmentController.php b/typo3/sysext/install/Classes/Controller/EnvironmentController.php index 8bdb9b39da013a93de56c197b6f2c6c7c1c71ed3..fc24a0c212aadbf9797f44bd2059b7c8a0503c92 100644 --- a/typo3/sysext/install/Classes/Controller/EnvironmentController.php +++ b/typo3/sysext/install/Classes/Controller/EnvironmentController.php @@ -1183,7 +1183,7 @@ class EnvironmentController extends AbstractController return new FlashMessage( 'ImageMagick / GraphicsMagick handling is enabled, but the execute' . ' command returned an error. Please check your settings, especially' - . ' [\'GFX\'][\'processor_path\'] and [\'GFX\'][\'processor_path_lzw\'] and ensure Ghostscript is installed on your server.', + . ' [\'GFX\'][\'processor_path\'] and ensure Ghostscript is installed on your server.', 'Image generation failed', FlashMessage::ERROR ); diff --git a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php index a676db5e3470768d0ed8d665bbbc7610a37621cb..71649d30aa2a43939f80fdcfc91a33bee7933071 100644 --- a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php +++ b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php @@ -175,6 +175,9 @@ class SilentConfigurationUpgradeService 'EXT/allowLocalInstall', // #97265 'BE/explicitADmode', + // Please note that further migrations in this file are kept in order to remove the setting at the very end + // #97797 + 'GFX/processor_path_lzw', ]; public function __construct(ConfigurationManager $configurationManager) @@ -475,12 +478,6 @@ class SilentConfigurationUpgradeService $currentPathValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_path'); } - try { - $currentPathLzwValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/processor_path_lzw'); - } catch (MissingArrayPathException $e) { - $currentPathLzwValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/processor_path_lzw'); - } - try { $currentImageFileExtValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/imagefile_ext'); } catch (MissingArrayPathException $e) { @@ -497,9 +494,6 @@ class SilentConfigurationUpgradeService if ($currentPathValue != '') { $changedValues['GFX/processor_path'] = ''; } - if ($currentPathLzwValue != '') { - $changedValues['GFX/processor_path_lzw'] = ''; - } if ($currentImageFileExtValue !== 'gif,jpg,jpeg,png') { $changedValues['GFX/imagefile_ext'] = 'gif,jpg,jpeg,png'; } diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php index 3869e3e0a33a514e80165699467901b7bf60df6e..beb003c42317ab62078cc3333783e8443c9025ed 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php @@ -755,4 +755,9 @@ return [ 'Feature-97737-PSR-14EventsWhenPageRootlineInFrontendIsResolved.rst', ], ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'GFX\'][\'processor_path_lzw\']' => [ + 'restFiles' => [ + 'Breaking-97797-GFXSettingProcessor_path_lzwRemoved.rst', + ], + ], ]; diff --git a/typo3/sysext/install/Resources/Private/Templates/Environment/ImageProcessing.html b/typo3/sysext/install/Resources/Private/Templates/Environment/ImageProcessing.html index 15092c74fdea812081c837f96bce5e9c8de176b5..398146a96195e659d30832a335679f6d987a26b5 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Environment/ImageProcessing.html +++ b/typo3/sysext/install/Resources/Private/Templates/Environment/ImageProcessing.html @@ -68,7 +68,7 @@ <h3>Writing gif, png, webp</h3> <p> This verifies that ImageMagick is able to write GIF and PNG and WEBP files. - The GIF-file is attempted compressed with LZW by the + The GIF-file is attempted compressed by the <code>\TYPO3\CMS\Core\Imaging\GraphicalFunctions::gifCompress()</code> function. </p> <h4>Write gif</h4> diff --git a/typo3/sysext/install/Resources/Public/Images/TestReference/About.txt b/typo3/sysext/install/Resources/Public/Images/TestReference/About.txt deleted file mode 100644 index 5220611232cf5619818911c4411205bdea8ea5cb..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/Images/TestReference/About.txt +++ /dev/null @@ -1,30 +0,0 @@ -These comparison images was generated by Kasper Skårhøj, using: - -- TYPO3 3.8.0 - -- Image Magick 5.5.7 / FreeType 2 / PHP4 - -- This localconf.php configuration: -$TYPO3_CONF_VARS['GFX']['processor_path_lzw'] = ''; -$TYPO3_CONF_VARS['GFX']['TTFdpi'] = '96'; -$TYPO3_CONF_VARS['GFX']['gdlib_png'] = '1'; -$TYPO3_CONF_VARS['GFX']['processor_path'] = '/usr/bin/'; -$TYPO3_CONF_VARS['GFX']['processor'] = 'im5'; -$TYPO3_CONF_VARS['GFX']['processor_effects'] = true; -$TYPO3_CONF_VARS['GFX']['gdlib_2'] = 1; - -- PHP / GD configuration: -GD Support enabled -GD Version 2.0 or higher -FreeType Support enabled -FreeType Linkage with freetype -T1Lib Support enabled -GIF Read Support enabled -GIF Create Support enabled -JPG Support enabled -PNG Support enabled -WBMP Support enabled - -- I was not able to create GIF files for reference so I just converted them directly with ImageMagick - -- Also LZW compression has NOT been used anywhere except the GD test images since ImageMagick doesn't support it. diff --git a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php index 53550b1f6a261a1b2a62e16288d586b7176a39d5..0344aed940d01975c2da23e76520221a46783df5 100644 --- a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php @@ -385,7 +385,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase $currentLocalConfiguration = [ ['GFX/im', 0], ['GFX/im_path', ''], - ['GFX/im_path_lzw', ''], ['GFX/imagefile_ext', 'gif,jpg,png'], ['GFX/thumbnails', 0], ]; @@ -396,7 +395,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase 'setLocalConfigurationValuesByPathValuePairs', ] ); - $this->configurationManager->expects(self::exactly(5)) + $this->configurationManager->expects(self::exactly(4)) ->method('getLocalConfigurationValueByPath') ->willReturnMap($currentLocalConfiguration); $this->configurationManager->expects(self::never()) @@ -430,7 +429,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase $currentLocalConfiguration = [ ['GFX/im', 1], ['GFX/im_path', ''], - ['GFX/im_path_lzw', ''], ['GFX/imagefile_ext', 'gif,jpg,jpeg,png'], ['GFX/thumbnails', 0], ]; @@ -441,7 +439,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase 'setLocalConfigurationValuesByPathValuePairs', ] ); - $this->configurationManager->expects(self::exactly(5)) + $this->configurationManager->expects(self::exactly(4)) ->method('getLocalConfigurationValueByPath') ->willReturnMap($currentLocalConfiguration); $this->configurationManager->expects(self::never())