#!/usr/bin/perl use File::Find; my $base = "/u11/gile/.html_pages/screens"; sub img_thumbnail { my $file = shift; if (open(THUMB, "$base/thumb/$file")) { close(THUMB); } else { `/usr/local/bin/convert -scale 120x120 -negate "$base/$file" "$base/thumb/$file"` } } sub img_size { my $file = shift; my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file); my $inter = int(($size / 1024) * 100); return $inter / 100; } sub img_wanted { my $file = $_; if ($File::Find::dir eq $base) { if ($file =~ /.*\.(gif|jpeg|jpg|png)/) { my $size = img_size($file); print "
\n"; img_thumbnail($file); } } } sub iterate_and_print { find({"wanted" => \&img_wanted, "follow" => 0 }, ($base)); } print "Content-type: text/html\r\n\r\n"; #header print "This used to be only a section for random screen shots that I made. Some were from projects I worked on, others from systems being used. Now, it's just a general collection of images and pictures.
I'm sure some of you out there are asking why I don't using something like Gallery to accomplish this. Simple, something like that has too much for my needs. That, and here, I just add images and they automatically show up in the index. That's all I really need.