Saturday, 15 September 2012

pdf - PHP Uncaught exception 'ImagickException' with message 'FailedToExecuteCommand' -



pdf - PHP Uncaught exception 'ImagickException' with message 'FailedToExecuteCommand' -

i've installed imagemagick php extension on mac via pecl. it's showing under phpinfo(), , lists pdf supported format.

i'm trying read in pdf , convert image. constructor throws exception when source pdf. image files work successfully.

$im = new imagick('testdoc.pdf[0]'); // throws exception when pdf specified. //$im = new imagick('testimage.png'); // succeeds. $im->setimageformat('jpg'); header('content-type: image/jpeg'); echo $im; fatal error: uncaught exception 'imagickexception' message 'failedtoexecutecommand `"gs" -q -dquiet -dsafer -dbatch -dnopause -dnoprompt -dmaxbitmap=500000000 - daligntopixels=0 -dgridfittt=2 "-sdevice=pngalpha" -dtextalphabits=4 -dgraphicsalphabits=4 "-r72x72" -dfirstpage=1 -dlastpage=1 "-soutputfile=/var/tmp/magick-43594xlarxegwg1ps%d" "- f/var/tmp/magick-43594o_wvqnajtgzr" "-f/var/tmp/magick-43594ivj_pkbcf3s7"' (-1) @ error/utility.c/systemcommand/2029' in /users/garys/documents/projects/accrivia/code/test/test.php:8 stack trace: #0 /users/garys/documents/projects/accrivia/code/test/test.php(8): imagick- >__construct('../testdoc.pdf[...') #1 {main} thrown in /users/garys/documents/projects/accrivia/code/test/test.php on line 8

the tmp file mentioned in output created, 0 bytes. if execute total 'gs' command in message (using actual files) on command line, works successfully.

imagemagick , ghostscript installed brew.

in php, system('echo $path'); gives /usr/bin:/bin:/usr/sbin:/sbin 'gs' in /usr/bin/

does have suggestion. web search exception message turns nil specific.

many gary.

never used imagemagick myself documents says needs ghostscript read pdf documents

pdf back upwards : requires ghostscript read.

edit: have checked ghostscript working?

php pdf imagemagick ghostscript

No comments:

Post a Comment