Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-13-2004, 07:29 AM   PM User | #1
samroberts
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
samroberts is an unknown quantity at this point
Imagemagick issues

Hello,

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:

-----BEGIN-----

$LARGE_PATH="/home/lbier/public_html/lambda/large/";
$THUMB_PATH="/home/lbier/public_html/lambda/thumbs/thumb_";

copy($image_file[0],$LARGE_PATH.$image_file_name[0]);

$quality="100";
$res="150x100";
@exec("which convert", $my_convert_path);

$imagePath=$LARGE_PATH.$image_file_name[0];
$resizedFile=$THUMB_PATH.$image_file_name[0];

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

-----END-----

Any ideas on what I'm doing wrong?
samroberts is offline   Reply With Quote
Old 01-13-2004, 03:19 PM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,911
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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)
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 01-13-2004, 05:04 PM   PM User | #3
samroberts
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
samroberts is an unknown quantity at this point
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."\"");

is:

-resize 150x100 -quality 100 "/home/lbier/public_html/lambda/large/cliff.jpg" "/home/lbier/public_html/lambda/thumbs/thumb_cliff.jpg"
samroberts is offline   Reply With Quote
Old 01-13-2004, 11:20 PM   PM User | #4
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,911
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
check the path first then...


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

if( is_array( $my_convert_path ) ){
print_r( $my_convert_path ) ;
}else{
echo $my_convert_path.'<br />';
}
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 01-14-2004, 01:40 AM   PM User | #5
samroberts
New to the CF scene

 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
samroberts is an unknown quantity at this point
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.
samroberts is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:04 AM.


Advertisement
Log in to turn off these ads.