#!/usr/bin/perl # use Image::Size; require '/home/lj/cgi-bin/ljlib.pl'; &connect_db(); my $num = shift @ARGV; if ($num) { my $sth = $dbh->prepare("SELECT mood, moodid FROM moods"); $sth->execute; $moodid{$_->{'mood'}} = $_->{'moodid'} while ($_ = $sth->fetchrow_hashref); $dir = shift @ARGV; unless ($dir) { die "No directory prefix given!\n"; } unless ($dir =~ /\/$/) { $dir .= "/"; } } opendir (DIR, "."); @files = readdir DIR; open (HTML, ">index.html"); print HTML "
\n"; print HTML "$file"; if ($moodid = $moodid{$noext}) { print HTML " ($moodid)"; if ($num) { $dbh->do("REPLACE INTO moodthemedata (moodthemeid, moodid, picurl, width, height) VALUES ($num, $moodid, $quri, $w, $h)"); print "REPLACE INTO moodthemedata (moodthemeid, moodid, picurl, width, height) VALUES ($num, , $quri, $w, $h);\n"; } } else { if ($num) { print "REPLACE INTO moodthemedata (moodthemeid, moodid, picurl, width, height) VALUES ($num, , $quri, $w, $h);\n"; } } print HTML " | "; foreach $col ("#FFFFFF", "#000000", "#C0C0C0", "#FFFF00", "#FF0000") { print HTML ""; } print HTML " |