mkdir S
# Include the HTML header file
cat ~/public_html/header.html > $1
# The following loop creates a thumbnail in the 'S' directory
# for each JPEG image and creates a line of HTML for each one,
# placing a carriage return after every six images.
#
# WIDTH and HEIGHT tags are supplied for the thumbnail images by
# decompressing the thumbnail into a ppm, pulling the width/height
# line out of the ppm file, and processing it to place the tag
# specifiers into their appropriate places.
#
set count=0
foreach i (*.jpg *.jpeg *.JPG *.JPEG)
echo $i
cat $i | djpeg -scale 1/8 | cjpeg -progressive -quality 90 > S/$i
echo '' >> $1
set count=`expr $count + 1`
if (`expr $count \% 3` == '0') then
echo '' >> $1
endif
end
# Include the HTML footer file
cat ~/public_html/footer.html >> $1
# Set all the necessary permissions to make this web-readable
chmod 711 .
chmod 644 $1
chmod 644 *.jpg *.jpeg *.JPG *.JPEG
chmod 711 S
chmod 644 S/*.jpg S/*.jpeg S/*.JPG S/*.JPEG