Bug #21260
closedSpaces in Webroot path break ImageMagick compose
0%
Description
Install Tool -> Image Processing -> Combining images
shows all masks inverted if webroot path contains breaks.
Tested with GraphicsMagick on Windows only but is probably true for IM and Linux too.
Function unQuoteFilenames() in t3lib/class.t3lib_div explodes the parameter string by blanks but tries to do a kind of CVS explode that honors quotes within the parameter string and does not explode quoted params if they contain blanks.
This function works correct, but it does not return an array with continuously numbered indices. Function imageMagickCommand() in turn expects an evenly numbered array when it tries to exchange the last but third and last but second elements (-4th and -3rd element) of the exploded array in block if(count($paramsArr)>5)...
The solution is simple:
Change the last line of function unQuoteFilenames() from
return $paramsArr;
to
return array_values($paramsArr);
This reindexes the returned array with continous indices and solves the problem. Patch appended.
Cheers, Jörg.
(issue imported from #M12218)
Files
Updated by Jörg Wagner about 15 years ago
Here is an example of the content of the array returned from function t3lib_div::unQuoteFilenames() WITHOUT and WITH the patch, and also the state of the array after the calling function imageMagickCommand() has tried to exchange elements count($arr)-3 and count($arr)-4 in this array. As you can see the exchange only works if the patch is applied, otherwise the array is messed up.
WITHOUT PATCH
as returned from unQuoteFilenames:
Array
(
[0] => -compose
[1] => over
[2] => +matte
[3] => "D:/My Web/typo3/sysext/install/imgs/greenback.gif"
[5] => "D:/My Web/typo3/sysext/install/imgs/jesus.jpg"
[7] => "D:/My Web/typo3temp/temp/916767b3cc02b31a0c0039f8c470956a.gif"
[9] => "D:/My Web/typo3temp/install_44f1273ab1.jpg"
)
WITHOUT PATCH
after exchanging count($arr)-3 and count($arr)-4:
Array
(
[0] => -compose
[1] => over
[2] => +matte
[3] => "D:/My Web/typo3/sysext/install/imgs/greenback.gif"
[5] => "D:/My Web/typo3/sysext/install/imgs/jesus.jpg"
[7] => "D:/My Web/typo3temp/temp/916767b3cc02b31a0c0039f8c470956a.gif"
[9] => "D:/My Web/typo3temp/install_44f1273ab1.jpg"
[4] =>
)
WITH PATCH
as returned from unQuoteFilenames:
Array
(
[0] => -compose
[1] => over
[2] => +matte
[3] => "D:/My Web/typo3/sysext/install/imgs/greenback.gif"
[4] => "D:/My Web/typo3/sysext/install/imgs/jesus.jpg"
[5] => "D:/My Web/typo3temp/temp/ab507b44c21494b9f959c874f7fd1fc6.gif"
[6] => "D:/My Web/typo3temp/install_44f1273ab1.jpg"
)
WITH PATCH
after exchanging count($arr)-3 and count($arr)-4:
Array
(
[0] => -compose
[1] => over
[2] => +matte
[3] => "D:/My Web/typo3/sysext/install/imgs/jesus.jpg"
[4] => "D:/My Web/typo3/sysext/install/imgs/greenback.gif"
[5] => "D:/My Web/typo3temp/temp/ab507b44c21494b9f959c874f7fd1fc6.gif"
[6] => "D:/My Web/typo3temp/install_44f1273ab1.jpg"
)
Updated by Jörg Wagner over 14 years ago
My patch has been applied to 4.3 but not to the 4.2 branch.
It should be applied there too.
Updated by Chris topher over 14 years ago
This was committed by Bernhard in Rev. 6162.