Project

General

Profile

Actions

Bug #24931

closed

Quoting of path and filename in ImageMagick/GraphicsMagick not working on Windows + PHP5.2

Added by Jörg Wagner almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Communication
Target version:
-
Start date:
2011-02-02
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Quoting of the path and filename of the ImageMagick/GraphicsMagick executable has been introduced with 4.4.5. Here is an example:

4.4.4:
C:\Programme\GraphicsMagick-1.3.7-Q8/gm.exe convert -geometry 50x50! "uploads/pics/myimage.gif[0]" "typo3temp/pics/f58c0b5193.gif"

4.4.5:
"C:/Programme/GraphicsMagick-1.3.7-Q8/gm.exe" convert +profile '*' -geometry 50x50! "uploads/pics/myimage.gif"[0] "typo3temp/pics/f58c0b5193.gif"

Both of these commands will work, if executed directly on the Windows command line. But the 4.4.5 version will fail when executed through the PHP exec() command on Windows <b>with PHP versions below 5.3</b>.
For the exec() command of PHP >=5.3 both commands will work nicely.

<b>Explanation for PHP < 5.3:</b>
The quoting of the IM/GM executable path and filename in the complete command line requires the whole string to be quoted a second time, to make it work with exec() on Windows. Details can be found in the posting of "luko post cz", 30-Jan-2008 02:15, on http://php.net/manual/en/ref.exec.php

The working version for 4.4.5 must look like this:

""C:/Programme/GraphicsMagick-1.3.7-Q8/gm.exe" convert +profile '*' -geometry 50x50! "uploads/pics/myimage.gif"[0] "typo3temp/pics/f58c0b5193.gif""

<b>Explanation for PHP >=5.3:</b>
The PHP 5.3.0 change log (http://php.net/ChangeLog-5.php) contains a hint that the exec() behavior has been changed:

Version 5.3.0
30-June-2009
...
Fixed exec() on Windows to not eat the first and last double quotes. (Scott)

<b>Bottom line</b>
Quoting twice is the way to go on Windows, but is needed and working only for PHP versions below 5.3 on Windows. For PHP >=5.3 this is NOT needed and actually results in an error!

The attached patches for TYPO3 4.4.5 and TYPO3 4.5.0 will correct the problem with all PHP 5 versions on Windows.

(issue imported from #M17447)


Files

17447_JW_v1_4.4.5.diff (325 Bytes) 17447_JW_v1_4.4.5.diff Administrator Admin, 2011-02-02 13:43
17447_JW_v1_4.5.0.diff (371 Bytes) 17447_JW_v1_4.5.0.diff Administrator Admin, 2011-02-02 13:43

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #22243: Several GIFBUILDER features broken for IM6 and GMClosedJigal van Hemert2010-03-05

Actions
Is duplicate of TYPO3 Core - Bug #24281: ImageMagick does not work with quotes in exec() path on WindowsClosedJigal van Hemert2010-12-03

Actions
Actions

Also available in: Atom PDF