Page 1 of 1

image magick paths

Posted: 2007-10-15T14:09:09-07:00
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?

Re: image magick paths

Posted: 2007-10-16T00:12:39-07:00
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>";

Re: image magick paths

Posted: 2007-10-17T10:53:56-07:00
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

Re: image magick paths

Posted: 2007-10-17T11:12:02-07:00
by Bonzo
I would say ImageMagick is not installed correctly. Thats as much as I can suggest :?