Page 1 of 1

ImageMagick Path Problem

Posted: 2010-09-06T00:59:30-07:00
by jishcem
Hi all,

I am a newbie in Imagemagick. I tried to convert an jpg image to png using this PHP script

exec('/usr/local/lib/ImageMagick/convert -convert grass.jpg grass.png', $report);
print_r($report);

My hosting providers told me that the path to Imagemagick is /usr/local/lib/ImageMagick

I think, it is because I have used the wrong command or command is wrong,

Thanking you for any help...

Re: ImageMagick Path Problem

Posted: 2010-09-06T07:31:56-07:00
by Bonzo
You will be better off posting this sort of question in the users section as this section is for Imagick.

Try these to confirm what you have:

Code: Select all

<?php
echo "<pre>";
system("type convert"); 
echo "</pre>";
?> 
 OR
<?php
echo "<pre>";
system('which convert',$path); print_r($path); 
echo "</pre>";
?> 
Version
<?php
echo "<pre>";
system("convert -version");  
echo "</pre>";
?> 
Your code is incorrect ( I can get away with just convert and not /usr/local/lib/ImageMagick/convert ):

Code: Select all

exec('/usr/local/lib/ImageMagick/convert grass.jpg grass.png', $report);
print_r($report);

Re: ImageMagick Path Problem

Posted: 2010-09-06T09:46:20-07:00
by jishcem
Thank you very much for your support, and sorry for posting this here. I figured out that my path was incorrect. What went wrong was the foolish service provider told me the wrong path. And my command was also incorrect. Actually after getting the correct path, the problem solved. Thank you very much for your support once again :)

Re: ImageMagick Path Problem

Posted: 2010-09-06T11:00:41-07:00
by Bonzo
I am glad its sorted now; for some more php examples tips etc. take a look at my site.

For your information Imagick is an API? that is built into php 5 like GD whereas ImageMagick is an external program called from php.