#!/bin/sh
mkdir small
mkdir medium
#PATH=/home/althea/cameron/bin/pbm/:$PATH
cols="3"
smallscale="0.1"
mediumscale="0.4"
quality="75"
file="genphoto.txt"
tempgif=/tmp/$$.gif
if [ ! -f index.html ]; then
echo '' > index.html
chmod 755 index.html
fi
export PATH
echo "
" > $file
i=0;
for v in *JPG; do
echo $v
if [ ! -s small/$v ]; then
jpegtopnm $v | pnmscale $smallscale | ppmtojpeg --quality=$quality > small/$v
fi
if [ ! -s medium/$v ]; then
jpegtopnm $v | pnmscale $mediumscale | ppmtojpeg --quality=$quality > medium/$v
fi
#get the size of the thumb
if [ ! -s small/$v.file ]; then
jpegtopnm small/$v | ppmquant 256 | ppmtogif > $tempgif
file $tempgif > small/$v.file
fi
width=`cat small/$v.file | sed -e 's/.* \([0-9]*\) x \([0-9]*\).*/\1/'`
height=`cat small/$v.file | sed -e 's/.* \([0-9]*\) x \([0-9]*\).*/\2/'`
#/tmp/12789.gif: GIF image data, version 87a, 400 x 300,
#/tmp/21148.gif: GIF image data, version 87a, 160 x 120,
echo " [ s | m | l ] | " >> $file
i=`expr $i + 1`
if [ $i -eq $cols ]; then
echo "
" >> $file
i=0;
fi
sleep 1
done
echo "
" >> $file