image magick paths

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
dravidian7

image magick paths

Post by dravidian7 »

I'm having a hell of a time getting convert or mogrify to resize my images on our web server and i think it has something to with the paths.
My code works locally on windows appserv using php5

My live server uses php5,etc also.

the path to imagemagick files are: user/bin
php scripts are running from: var/www/html
images i want to resize are being save to: var/www/html/test/thumbs

I can get it working using putty when in the web root dir (var/www/html/)

I'm specifying this all in my code. I'm able to save the files to the specifed folder but the images are not being converted.

Can anyone help me?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: image magick paths

Post by Bonzo »

I always use relative paths rather than absolute for the images.

You can try the examples below to confirm your path to convert is correct.

Code: Select all

<?php
echo "<pre>";
system("type convert"); 
echo "</pre>";
?> 

<?php
echo "<pre>";
system('which convert',$path); print_r($path); 
echo "</pre>";
?>
You can modify your code to this to display any errors.

Code: Select all

exec("convert input.jpg -resize 200x200 output.jpg 2>&1", $array); 
echo "<br>".print_r($array)."<br>";
dravidian7

Re: image magick paths

Post by dravidian7 »

HI, thanks for that, that narrows the problem down the following...i get an error when running this code...

Code: Select all

<?
echo '<br>New:';

echo "<pre>";
system("type convert"); 
echo "</pre>";

echo "<pre>";
system('which convert',$path); print_r($path); 
echo "</pre>";
$filename = 'old20071015101426.jpg';
exec("convert $filename -resize 200x200 output.jpg 2>&1", $array); 
echo "<br>".print_r($array)."<br>";
exec("/usr/bin/convert $filename -resize 200x200 output.jpg 2>&1", $array); 
echo "<br>".print_r($array)."<br>";
?>
output:

New:
convert is /usr/bin/convert
/usr/bin/convert
0
Array ( [0] => convert: error while loading shared libraries: liblcms.so.1: cannot open shared object file: No such file or directory )
1
Array ( [0] => convert: error while loading shared libraries: liblcms.so.1: cannot open shared object file: No such file or directory [1] => /usr/bin/convert: error while loading shared libraries: liblcms.so.1: cannot open shared object file: No such file or directory )
1

What could cause this?
the script is in var/www/html
the path to imagemagick is usr/bin

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

Re: image magick paths

Post by Bonzo »

I would say ImageMagick is not installed correctly. Thats as much as I can suggest :?
Post Reply