#!/bin/sh
#This is a simple script that uses ImageMagick to create thumbnails
#and a nice HTML table with clickable pictures and an index to html files
#in the current directory. I have only used this under Solaris so YMMV
PATH=$PATH:/usr/sfw/bin
export PATH
cat << FOO
gallery
FOO
k=0
if [ ! -d thumbs ]
then
mkdir thumbs
fi
for i in *
do
file $i | egrep -i 'JPEG|PNG' >/dev/null 2>&1
if [ $? -eq 0 ]
then
if [ ! -f thumbs/$i ]
then
echo converting $i >&2
convert -resize 160x100 $i thumbs/$i
fi
if [ $k -gt 5 ]
then
echo "
"
k=0
fi
echo " | "
k=`expr $k + 1`
fi
done
echo "
"
for i in *
do
file $i | grep -i HTML >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "
$i"
fi
if [ $i = "gallery.sh" ]
then
rm -f gallery.txt
ln gallery.sh gallery.txt
fi
done
cat << FOO
This page was made by a custom shell script click
here to view the script.
FOO