#!/bin/sh # # mkthumb *.jpg ... # # Create an index.html with thumbnails with hyper-links to the full size jpegs. # # Boyd Roberts # April 2000 (things happen to me in April, maybe I was a Marine in a former # life -- ``things happen to Marines''. # myname="`basename \"$0\"`" year="`date '+%Y'`" name='Boyd Roberts' email='boyd@fr.inter.net' index='index.html' thumb='thumb' scale() { djpeg -pnm "$1" | pnmscale -width 160 -height 120 | cjpeg } header=' title

title

text


' footer="


© $year, $name: $email " case $# in 0) echo "usage: $myname [ *.jpeg | *.jpg ] ..." 1>&2 exit 1 ;; esac if [ ! -d "$thumb" ] then if mkdir "$thumb" then : else echo "$myname: Could not mkdir '$thumb'." 1>&2 exit 1 fi fi ( echo "$header" n= for j do # get extension x="`expr \"$j\" : '.*\.\(.*\)'`" case "$x" in jpg|JPG|jpeg|JPEG) ;; *) echo "$myname: Can't convert '$j'." 1>&2 continue ;; esac echo "" scale "$j" > "$thumb/$j" case "$n" in ...) echo '
' n='' ;; *) n="$n." ;; esac done case "$n" in '') ;; *) echo '
' ;; esac echo "$footer" ) > "$index"