Image Magick does not work with php

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply

Image Magick does not work with php

Post by kleinstadtmc » 2006-09-19T02:42:54-07:00


i installed the newest version of image magick on my server
it seemed it works...

but if i use image magick with the exec() command over php
nothing happends

here my code

Code: Select all

/usr/local/bin/convert -geometry 400x300 /tmp/phpRRyXt9 /srv/www/vhosts/
if i use the status var and the command line array from exec() function
the var give a 1 back
and the array is empty

is it ok to writ the absolute path from root for saving the pic?


Post by M3g4Star » 2006-09-19T06:56:04-07:00

I got a similar Problem and I got my answer that way:

Code: Select all

$bla = '/usr/local/bin/convert '.$input.' -sepia-tone 87% -colorize 13% '.$output_nos_s;

  echo $bla;
   exec ("$bla, 2>&1", $output);
       foreach($output as $outputline){
So I got an Error :
convert: unable to open module file `/usr/local/lib/ImageMagick-6.2.9/modules-Q16/coders/jpg,.la': No such file or directory.

Is there any Solution ??
I just try to reinstall the newest Version of ImageMagick cause I need "sepia-tone" !!!

I recognized that PHP takes an older Version so I had to put the Path of my newer Imagemagick Version in front of Convert ..

So it works !!! ^^

Posts: 2970
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo » 2006-09-19T10:17:50-07:00

kleinstadtmc I found when I started you do not need the full path on the server a relative path will do.

Some times if you put /srv/www/vhosts/ into the exec comand as you have done it causes a problem but if you put the path into a variable and put the variable into the exec comand it seems to work !

Code: Select all

/usr/local/bin/convert -geometry 400x300 /tmp/phpRRyXt9 /srv/www/vhosts/
For a start you do not have an image extension for /tmp/phpRRyXt9

Code: Select all

exec("/usr/local/bin/convert /tmp/phpRRyXt9.jpg -thumbnail 400x300  /pics/pic.jpg");
I have some php code examples on that may help.

Post Reply