View Single Post
  #3  
Old 9th September 2010, 14:00
angela angela is offline
Junior Member
 
Join Date: Aug 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for wanting to help.

I've got something similar to yourcode. The routines are already proven on my old running server.

The only difference between my code and yours is the image I fetch remains in memory; so I do a blobToImage convert on the fetched data before pushing it out.

Code:
 use LWP::UserAgent;
 use CGI;
 use HTTP::Cookies;
 use CGI::Carp qw/fatalsToBrowser/;
 use strict;
 use Image::Magick

[snip]


      if ($secres->is_success) {
print $query->header(-type => 'image/gif', -expires => 'now');
            binmode STDOUT, ":raw";
            my $image=Image::Magick->new(magick=>'gif');
            $image->BlobToImage($secres->{'_content'});
            $image->Threshold(threshold=>'60%');
            $image->Quantize(colors=>'8');
            $image->Sharpen(0.0x1.0);
            $image->Write('gif:-');
    }
    else {
# bail out gracefully...

 [snip]
I can get the routine to work by doing

Code:
      if ($secres->is_success) {
 print $query->header(-type => 'image/gif', -expires => 'now');
 binmode STDOUT, "raw:";
 print $secres->{'_content'};
}
But I really need ImageMagick for its resizing and optimizations.

And I say, it all runs from the command line just fine. I'm really mystified.

Last edited by angela; 27th September 2010 at 21:36.
Reply With Quote