#!/usr/bin/perl -w use warnings; use CGI qw/:standard/; use POSIX; use DB_File; my %upload; my $upload = "imagegallery.db"; # full file path to image directory my $imagedir = "http://sulfericacid.perlmonk.org/gallery/images/"; tie %upload, "DB_File", "$upload", O_CREAT | O_RDWR, 0644, $DB_BTREE or die "Cannot open file 'upload': $!\n"; print header, start_html('My Image Gallery'); my $page = url_param('page'); $page ||= 1; # if no url_param exists, make it 1 my $first = ($page - 1) * 20; my $last = $first + 19; print "\n"; my $counter = 0; for (grep defined($_), (reverse keys %upload)[$first .. $last]) { my ( $filename, $title, $desc, $width, $height ) = split ( /::/, $upload{$_} ); print " " unless ( $counter % 5 ); $title =~ s/(\S{11})/$1 /g; $desc =~ s/(\S{11})/$1 /g; print qq(); unless ( ++$counter % 5 ) { print "\n"; } } print "
), qq[], qq[
]; $filename =~ s/(\S{11})/$1 /g; print qq(Filename:$filename
), qq(Title:$title
), qq(Desc:$desc
), qq(Dimens: $width x $height
), qq(
"; my @keys = sort keys %upload; my $group = 0; while (my @group = splice(@keys, 0, 20)) { $group++; my $url = "http://sulfericacid.perlmonk.org/gallery/galleryprint2.pl"; print qq(Page: $group|\n); }