I suggest using Image::Magick for generating thumnails.  It is painless to
do and the resulting files are of good quality.  Here is a code snippet:

use Image::Magick;

my $im = new Image::Magick();
$im->Read($inputfile);
$im->Resize( geometry => "200x200" );
$im->Write($outputfile);
undef $im;

I would also not have the CGI script handle this as it could be slow if
there are lots of files to process or very large images.  Instead try a cron
job (or some scheduled task) to create the thumbnails.  So when a new image
is uploaded the CGI script handling that could add an entry in a log, then
the scheduled task would check the log for files to process and handle them.
....But that is just a suggestion.

Rob


-----Original Message-----
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 5:24 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with "." to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in "do not display"

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack "H*",
"4a75737420416e6f74686572204d61635065726c204861636b65722c0d";
-- 
Scott R. Godin            | e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |    web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to