Imagemagick convert pdf to png

I am new to using command line and php. In doing so, I tried to figure out how to use ImageMagick using the exec () function. I have it now

$command="/usr/local/lib/ImageMagick  convert images/a.pdf images/a.png"; 

if(exec($command)){
    echo 'yes';
}
else{
    echo 'no';
}

Which returns no. I believe that I am missing something about how to perform the conversion from the correct directory. Is my team set up correctly? (I was given the way to ImageMagick from my web host, Lunarpages).

I read some other questions regarding ImageMagick, but I did not find much to help me set up my team.

Thanks for any help,
Levy

+1
source share
2 answers

/usr/local/lib/ImageMagick, , , . ImageMagick , :

/usr/local/lib/ImageMagick/convert images/a.pdf images/a.png

! , , convert!

+4

exec() , exec , :

$command="/usr/local/lib/ImageMagick/convert images/a.pdf images/a.png"; 

exec($command,$output,$result);
if ($result == true ){
    echo 'yes';
}
else{
    echo 'no, here what happened with command output';
    print_r($output);
}

http://php.net/manual/en/function.exec.php

0

All Articles