View Full Version : Imagemagick issues

01-13-2004, 08:29 AM

I've used Imagemagick on several sites - I've occasionally run into problems, but with a little tweaking, it's fixed.

On the site I'm currently working on, I'm having no such luck. Images get uploaded without issue, but the thumbnail creation fails. I'm posting a portion of the relevant code here:




@exec("which convert", $my_convert_path);


$make_magick = system("convert -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);


Any ideas on what I'm doing wrong?

01-13-2004, 04:19 PM
you are putting the path of `convert` into $my_convert_path (which may well be an array so check it ) but not actually using it

system("convert -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);

e.g use $my_convert_path (or $my_convert_path[0] ) instead.

I have had occaision to use `mogrify` or one of the other IM commands before when 'convert' pointed to a totally different application but that would be unusual (on *NIX)

01-13-2004, 06:04 PM
I've made the appropriate change, but no thumb is being created.

I am now using:

$make_magick = system($my_convert_path[0]." -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);

However, when I print out this statement, $my_convert_path[0] is empty. The output for:

echo($my_convert_path[0]." -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"");


-resize 150x100 -quality 100 "/home/lbier/public_html/lambda/large/cliff.jpg" "/home/lbier/public_html/lambda/thumbs/thumb_cliff.jpg"

01-14-2004, 12:20 AM
;) check the path first then...

@exec("which convert", $my_convert_path);

if( is_array( $my_convert_path ) ){
print_r( $my_convert_path ) ;
echo $my_convert_path.'<br />';

01-14-2004, 02:40 AM
Okay, I came up with a slightly kludgey solution to this. My $my_convert_path is an empty array for some reason.

I looked up some earlier code that I used on another server and dropped it in:

@exec("/usr/local/bin/mogrify -scale ".$res." -quality ".$quality." \"".$resizedFile."\"");

I now copy the large file to the thumb folder and use only one path in the command line (the one contained in $resizedFile).

This isn't an ideal solution, but it'll do for the moment.

Thanks for your help - much appreciated.