#! /bin/sh # # Here is a script for making thumbnails and an index.html file # for a directory of jpegs. # # It expects to see a bunch of .jpg or .JPG files in the current # working directory. It chmod 644's all of them, moves all the # .JPG files to .jpg if it doesn't cause a conflict, creates thumbnails # for all of the images, and emits a simple HTML file to easily # browse the images. # For best results, you'll have images with names like # "jason-before-the-game.jpg" (underbars are treated the same). # The resulting HTML file will have a name like "jason before the game" # displayed under the thumbnail. # The thumbnail filenames are based on the image filename. If an image # is called foo.jpg, the thumbnail is foo-t.jpg. # You can adjust the size of the thumbnails with the MAXTHUMBWIDTH and # MAXTHUMBHEIGHT variables down below. # You can adjust the number of columns by changing COLUMNS. # If there is no index.html file present, this script creates one. # If there is an index.html file already, this script sends tthe # HTML it wants to create to stdout. # If you want to leave images out of the HTML index, list them in # a file called DONTSHOW.txt (list the full filenames). They will be # ignored by this script then. # RCS ID: $Id: makethumbs.sh,v 1.5 1998/09/21 07:59:25 molenda Exp $ #---------------------------------------------------------------------- # Written by Jason Molenda, jason-mt@molenda.com, 1998-09-13. This script # is placed in the public domain. #---------------------------------------------------------------------- umask 022 # this script is for making publically-accessable HTML pages; therefore # the following is always correct (for me, anyway :-). chmod 755 . MAXTHUMBWIDTH=150 MAXTHUMBHEIGHT=150 COLUMNS=3 dirname=`pwd | sed 's,^.*/,,'` if [ ! -f index.html ] then exec > index.html fi echo '
' echo "| ' echo -n ' ' else echo ' | ' echo ''
echo -n ' '
fi
if [ ! -f $j ]
then
djpeg -ppm < $i | pnmscale -xysize $MAXTHUMBWIDTH $MAXTHUMBHEIGHT | cjpeg -optimize > $j
fi
tninfo=`djpeg -ppm < $j | pnmfile`
tnx=`echo $tninfo | awk '{print $4}'`
tny=`echo $tninfo | awk '{print $6}'`
title=`echo $j | sed -e 's,-t.jpg,,' -e 's,-, ,g' -e 's,_, ,g'`
echo " ${title}" c=`expr $c + 1` if [ $c -eq $COLUMNS ] then c=0 fi done echo ' | '
echo '