diff --git a/typo3/sysext/core/Classes/Resource/Processing/AbstractGraphicalTask.php b/typo3/sysext/core/Classes/Resource/Processing/AbstractGraphicalTask.php index 6eefd567d7e251e6e71209a02654c78a866181bd..54f4ce4879f9adc9ff109b01088ef8e77660c8cb 100644 --- a/typo3/sysext/core/Classes/Resource/Processing/AbstractGraphicalTask.php +++ b/typo3/sysext/core/Classes/Resource/Processing/AbstractGraphicalTask.php @@ -14,6 +14,9 @@ namespace TYPO3\CMS\Core\Resource\Processing; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Core\Resource\AbstractFile; +use TYPO3\CMS\Core\Utility\GeneralUtility; + /** * Abstract base implementation of a task. * @@ -67,31 +70,14 @@ abstract class AbstractGraphicalTask extends AbstractTask { if (!empty($this->configuration['fileExtension'])) { $targetFileExtension = $this->configuration['fileExtension']; + } elseif ($this->getSourceFile()->getType() === AbstractFile::FILETYPE_IMAGE) { + $targetFileExtension = $this->getSourceFile()->getExtension(); + // If true, thumbnails from non-image files will be converted to 'png', otherwise 'gif' + } elseif ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails_png']) { + $targetFileExtension = 'png'; } else { - // explanation for "thumbnails_png" - // Bit0: If set, thumbnails from non-jpegs will be 'png', otherwise 'gif' (0=gif/1=png). - // Bit1: Even JPG's will be converted to png or gif (2=gif/3=png) - - $targetFileExtensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails_png']; - if ($this->getSourceFile()->getExtension() === 'jpg' || $this->getSourceFile()->getExtension() === 'jpeg') { - if ($targetFileExtensionConfiguration == 2) { - $targetFileExtension = 'gif'; - } elseif ($targetFileExtensionConfiguration == 3) { - $targetFileExtension = 'png'; - } else { - $targetFileExtension = 'jpg'; - } - } else { - // check if a png or a gif should be created - if ($targetFileExtensionConfiguration == 1 || $this->getSourceFile()->getExtension() === 'png') { - $targetFileExtension = 'png'; - } else { - // thumbnails_png is "0" - $targetFileExtension = 'gif'; - } - } + $targetFileExtension = 'gif'; } - return $targetFileExtension; } } diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 4e7b6448f144b9895582c61f418318b3fb80e599..57ba8b6e3c25a63edff59caa95515ba064d47140 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -20,7 +20,7 @@ return array( 'GFX' => array( // Configuration of the image processing features in TYPO3. 'IM' and 'GD' are short for ImageMagick and GD library respectively. 'thumbnails' => true, // Boolean: Enables the use of thumbnails in the backend interface. - 'thumbnails_png' => 0, // Bits. Bit0: If set, thumbnails from non-jpegs will be 'png', otherwise 'gif' (0=gif/1=png). Bit1: Even JPG's will be converted to png or gif (2=gif/3=png) + 'thumbnails_png' => true, // Boolean. If false, thumbnails from non-image files will be converted to 'gif', otherwise 'png' (default). 'gif_compress' => true, // Boolean: Enables the use of the \TYPO3\CMS\Core\Utility\GeneralUtility::gifCompress() workaround function for compressing giffiles made with GD or IM, which probably use only RLE or no compression at all. 'imagefile_ext' => 'gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg',// Commalist of file extensions perceived as images by TYPO3. List should be set to 'gif,png,jpeg,jpg' if IM is not available. Lowercase and no spaces between! 'gdlib' => true, // Boolean: Enables the use of GD. diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-73106-ConvertThumbnailsOnlyForNon-imageFiles.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-73106-ConvertThumbnailsOnlyForNon-imageFiles.rst new file mode 100644 index 0000000000000000000000000000000000000000..6ffa72a828417671bcceff784bfab9e1c44826e3 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-73106-ConvertThumbnailsOnlyForNon-imageFiles.rst @@ -0,0 +1,29 @@ +============================================================== +Breaking: #73106 - Convert thumbnails only for non-image files +============================================================== + +Description +=========== + +$TYPO3_CONF_VARS[GFX][thumbnails_png] must be taken into account only for non-image files. + + +Impact +====== + +$TYPO3_CONF_VARS[GFX][thumbnails_png] is now a boolean value. If the value is true, the processed +thumbnails that are not an image will be converted in png, otherwise these will be converted to gif. +It is not possible anymore to convert the processed thumbnails that are png or gif to jpg files. + + +Affected Installations +====================== + +Installations who have set the value of $TYPO3_CONF_VARS[GFX][thumbnails_png] to 2 or 3. + + +Migration +========= + +The install tool automatically sets the value of $TYPO3_CONF_VARS[GFX][thumbnails_png] to true, +if it has been set to 1, 2 or 3 previously. \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php index c508e5cd374566d7884d26cf01f4144a2c5a6537..cbf1b9436dcd7a0380b9764e50fa39c4dbbf1eb0 100755 --- a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php +++ b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php @@ -110,6 +110,7 @@ class SilentConfigurationUpgradeService $this->disableImageMagickDetailSettingsIfImageMagickIsDisabled(); $this->setImageMagickDetailSettings(); $this->removeObsoleteLocalConfigurationSettings(); + $this->migrateThumbnailsPngSetting(); } /** @@ -488,4 +489,26 @@ class SilentConfigurationUpgradeService 1379024938 ); } + + /** + * Migrate the configuration value thumbnails_png to a boolean value. + * + * @return void + */ + protected function migrateThumbnailsPngSetting() { + $changedValues = array(); + try { + $currentThumbnailsPngValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/thumbnails_png'); + } catch (\RuntimeException $e) { + $currentThumbnailsPngValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/thumbnails_png'); + } + + if (is_int($currentThumbnailsPngValue) && $currentThumbnailsPngValue > 0) { + $changedValues['GFX/thumbnails_png'] = true; + } + if (!empty($changedValues)) { + $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues); + $this->throwRedirectException(); + } + } }