Hi,
I have ImageMagick-6.4.2 installed along with ghostscript. I can successfully run the following command in Shell:
$ /usr/local/bin/convert -trim -density 150x150 -units pixelsperinch /usr/local/www/.../input.pdf /usr/local/www/.../output_%d.gif
but when I try this using exec(), passthrough(), shell_exec() or system() I get a failure code of 1.
This code works through PHP system("/usr/local/bin/convert logo: /usr/local/www/.../imlogo.gif", $rcode);
I'm thinking the problem might just be with PDF's but they seem to convert OK when running commands through the shell interface. Can anyone help or point me in the right direction? Is this a permissions problem? Permissions on the folders and files in question are 777.
Could this be a problem with the path to ghostscript in deligatemap.xml?
Many Thanks
Convert working in Shell for PDF but not in PHP
Re: Convert working in Shell for PDF but not in PHP
UPDATE
For anyone else who runs into this problem I changed all references of "gs" in delegatemap.xml to the full path of my gs binary and this now works in shell AND PHP. This has taken 4 hours of head scratching so I hope it helps someone else!
For anyone else who runs into this problem I changed all references of "gs" in delegatemap.xml to the full path of my gs binary and this now works in shell AND PHP. This has taken 4 hours of head scratching so I hope it helps someone else!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Convert working in Shell for PDF but not in PHP
Instead of setting the full path in the delegates, you probably need to ensure that gs was in the command PATH environment varible.
Unfortunately PHP has this horrible habit of preventing PHP scripts from setting the command path.
I am sure 'Bonzo' and his RubbleWeb website could help you with this.
Unfortunately PHP has this horrible habit of preventing PHP scripts from setting the command path.
I am sure 'Bonzo' and his RubbleWeb website could help you with this.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/