Bug #22514
closedimageMagickCommand parameters incorrectly swapped
0%
Description
In the class.t3lib_div.php function imageMagickCommand($command, $parameters, $path='') the section below is incorrect if $TYPO3_CONF_VARS['GFX']['im_useStripProfileByDefault'] = '1'
if($command=='composite' && $switchCompositeParameters) { // Because of some weird incompatibilities between ImageMagick 4 and 6 (plus GraphicsMagick), it is needed to change the parameters order under some preconditions
$paramsArr = self::unQuoteFilenames($parameters);
if(count($paramsArr)>5) { // The mask image has been specified => swap the parameters
$tmp = $paramsArr[count($paramsArr)-3];
$paramsArr[count($paramsArr)-3] = $paramsArr[count($paramsArr)-4];
$paramsArr[count($paramsArr)-4] = $tmp;
}
$cmdLine = $path.' '.implode(' ', $paramsArr);
}
The Strip Profile parameters are included in the count of parameters and so this is an incorrect method for testing if a mask image has been specified and it swaps the wrong parameters.
This was discovered when using the rounded_corners extension. The commands generated are constructed with $cmd = t3lib_div::imageMagickCommand('composite', '-gravity NorthEast '.$cornerNE .' '.$info3.' '.$newfile);
With $TYPO3_CONF_VARS['GFX']['im_useStripProfileByDefault'] = '1' set, the NorthEast parameter is swapped with the $cornerNE value, causing an error: gm composite: Unrecognized gravity type
localconf.php Image settings:
$TYPO3_CONF_VARS['GFX']['gdlib_png'] = '0';
$TYPO3_CONF_VARS['GFX']['im_combine_filename'] = 'composite';
$TYPO3_CONF_VARS['GFX']['im_path'] = '/usr/local/bin/';
$TYPO3_CONF_VARS['GFX']['im_path_lzw'] = '/usr/local/bin/';
$TYPO3_CONF_VARS['GFX']['im_version_5'] = 'gm';
$TYPO3_CONF_VARS['GFX']['im_imvMaskState'] = '1';
$TYPO3_CONF_VARS['GFX']['TTFdpi'] = '96';
$TYPO3_CONF_VARS['GFX']['im_useStripProfileByDefault'] = '1';
Setting $TYPO3_CONF_VARS['GFX']['im_useStripProfileByDefault'] = '0'; enables the rounded_corners extension to work correctly.
(issue imported from #M14204)