Commit 89a75c59 authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[BUGFIX] Apply quality settings for images

When combining or scaling images, the quality
setting needs to be applied as well.

Resolves: #31664
Releases: master, 9.5
Change-Id: Iab4d7247c1ee51483b9ede705f6c61ba11f37589
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60464

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 1b37fb72
......@@ -2481,7 +2481,9 @@ class GraphicalFunctions
// +matte = no alpha layer in output
$this->imageMagickExec($mask, $theMask, '-colorspace GRAY +matte');
$parameters = '-compose over +matte '
$parameters = '-compose over'
. ' -quality ' . $this->jpegQuality
. ' +matte '
. CommandUtility::escapeShellArgument($input) . ' '
. CommandUtility::escapeShellArgument($overlay) . ' '
. CommandUtility::escapeShellArgument($theMask) . ' '
......
......@@ -29,6 +29,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Install\FolderStructure\DefaultFactory;
use TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck;
......@@ -525,7 +526,8 @@ class EnvironmentController extends AbstractController
$imageProcessor = $this->initializeImageProcessor();
$inputFile = $imageBasePath . 'TestInput/Transparent.gif';
$imageProcessor->imageMagickConvert_forceFileNameBody = StringUtility::getUniqueId('scale-jpg');
$imResult = $imageProcessor->imageMagickConvert($inputFile, 'jpg', '300', '', '-opaque white -background white -flatten', '', [], true);
$jpegQuality = MathUtility::forceIntegerInRange($GLOBALS['TYPO3_CONF_VARS']['GFX']['jpg_quality'], 10, 100, 85);
$imResult = $imageProcessor->imageMagickConvert($inputFile, 'jpg', '300', '', '-quality ' . $jpegQuality . ' -opaque white -background white -flatten', '', [], true);
if ($imResult !== null && file_exists($imResult[3])) {
$result = [
'fileExists' => true,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment