#!/usr/bin/perl -w # We change this path when neccessary - we should really take an argument $dir = $ARGV[0]; $output = $dir."index.html"; opendir DIR, $dir or die "Can't open directory $dir: $!\n"; # grep out the current directory @files = grep !/^\./, readdir(DIR); open OUT, ">$output" or die "Cannot open $output for write:$!\n"; # we now print the start of the html &print_start; &print_table_start; $count = scalar (@files); $tempcount = 0; $extra = $count % 4; foreach $file (@files) { ($filename,$extension) = split /\./, $file; $thumfilename = $filename."TMB".".".$extension; $thumpath = $dir.$thumfilename; $filepath = $dir.$file; system("convert -size 100x100 $filepath $thumpath"); if( ($tempcount % 4) == 0) { # We need to finish the old row and start a new row if($tempcount != 0) { print OUT "\n"; } print OUT "