I lost some of the formatting, but this shoudl work
I denote thumbnails with an '_' as the leading character of the file name, which is why I glob the list of file names as I do; I could have made cleaner with sed, but oh well...
Code:
#!/bin/sh
INDEX="index.html"
if [ ! -f "index.html" ]
then
cat >> $INDEX << EOF
<html>
<head>
<link rel=stylesheet href='http://www.yourdomain.com/style.css' TYPE='text/css'>
<!--
Thom Fitzpatrick
-->
<meta name='description' content='Thom Fitzpatrick'> <title></title> </head> <body> <h4></h4> <p>
EOF
fi
for each in [a-zA-Z0-9]*.jpg [a-zA-Z0-9]*.JPG [a-zA-Z0-9]*.gif [a-zA-Z0-9]*.GIF [a-zA-Z0-9]*.TIF [a-zA-Z0-9]*.TIFF [a-zA-Z0-9]*.tif [a-zA-Z0-9]*.tiff [a-zA-Z0-9]*.png [a-zA-Z0-9]*.PNG do
[ -f "$each" ] || continue
[ ! -f "_$each" ] && convert -geometry 100 -quality 50 $each _$each
grep -qw "$each" $INDEX
if [ $? -ne 0 ]
then
cat >> $INDEX << EOF
<br clear=left>
<hr size=1><p>
<a href=$each><img src=_$each></a> <br clear=left>
EOF
fi
done