ImageMagick Path Problem

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
jishcem

ImageMagick Path Problem

Post 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...
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick Path Problem

Post 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);
jishcem

Re: ImageMagick Path Problem

Post 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 :)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick Path Problem

Post 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.
Post Reply