| [reply] |
Whaaaaahoooo!
I'd never heard of Imager and this module changes my life. All I have wanted to do is take client uploaded images, of any sort, and size them to jpeg thumbnails and full size for an online gallery. GD has lousy quality and ImageMagik is just too scary. Anyway, I had Imager working like a charm in minutes.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use Imager;
use warnings;
use strict;
use CGI::Carp qw(fatalsToBrowser);
my $img = Imager->new();
$img->read(file=>"../Uploaded_image.tif") or die $img->errstr;
my $imgfull = Imager->new();
my $imgfull = $img->scale(xpixels => 500); # 400x285
$imgfull->write(file=>"../Uploaded_image.jpg", type=>"jpeg")
or die "Cannot write: ", $imgfull->errstr;
my $imgthum = Imager->new();
my $imgthum = $img->scale(xpixels => 100); # 400x285
$imgthum->write(file=>"../Uploaded_image_thumb.jpg", type=>"jpeg")
or die "Cannot write: ", $imgthum->errstr;
Thanks!
—Brad "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
| [reply] [d/l] |
I usually use Imager as my first choice. Why? It's install is self-contained. With GD and ImageMagick, you have to install the c-libs first, and especially with GD, people are always running into compatibility problems between their Perl-GD module and the version of their GD-c-libs. Also, Imager has good perldocs. If you want to see an example of Imager, check out Mirrored text with Imager
I'm not really a human, but I play one on earth.
flash japh
| [reply] |
| [reply] |