path problems

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ebgb
Posts: 11
Joined: 2010-03-24T15:04:01-07:00
Authentication code: 8675308

path problems

Post by ebgb »

got around my previous probs but have come up against another one!
I'm executing via php using shell_exec()

if I run

Code: Select all

shell_exec(convert  -density 175 myfile.pdf  myfile.png)
from php....

I get a lovely png in the same directory as the pdf, which is cool

what I want is the converted file to be saved elsewhere, if I run the following directly in a terminal it works fine, saves the png elsewhere as expected:

Code: Select all

convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png

but if run that through php like this

Code: Select all

shell_exec(convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png)
server is running fedora 8 with the latest IM and ghostscript


the browser spins for a bit as though it is doing the conversion, but there is no file saved in the destination folder

server is running fedora 8 with elatest IM and ghostscript installed

but when I run the above locally on my little ubuntu box thats sat on my desk it runs perfectly, but not on the fedora remote server
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: path problems

Post by Bonzo »

Not sure what your problem is but try:

1/ Using "" around your command

Code: Select all

shell_exec("convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png")
2/ I assume the folder appro_png is CHMOD to 777

3/ Display any errors returned with

Code: Select all

$array = array();
echo "<pre>";
shell_exec("convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
4/ I use realtive paths and exec()
Post Reply