#! /usr/local/bin/perl

# 6.837
# Created by Justin Legakis (legakis@graphics.lcs.mit.edu) for Fall 1996
# Modified by Jon Levene (jslevene@graphics) for Fall 97


# Create thumbnail versions of all pictures in a directory.
# Requires the executable "6837-thumbnailer."

$picpath="../pictures_tmp";
$thumbpath="../thumbnails";
$scriptspath="../scripts";


opendir(THISDIR, $picpath);
@allfiles = grep(/^.*\.gif$/, readdir(THISDIR));
closedir(THISDIR);


foreach $file (@allfiles) {
 $thumbtitle = $file;
 $thumbtitle =~ s/.gif/_small.gif/g;

# if (!-e "$thumbpath/$thumbtitle") {

 print "$file  ->  $thumbtitle\n";
 $command = "$scriptspath/6837-thumbnailer $picpath/$file $thumbpath/$thumbtitle -s 96 -b 1 -c\n";

     system($command);

	chmod 0644, "$thumbpath/$thumbtitle"

# }
}

