#!/bin/bash


rm -f index.html

cnt=1

for i in `ls *.jpg | grep -v thumb`; do

  echo "Converting $i..."

  base=`basename $i .jpg`

  convert $i -geometry 342x207 -quality 70 $base-thumb.jpg

  echo "<a href=\"$i\"><img src=\"$base-thumb.jpg\"></a>" >> index.html

  if [ $cnt == 3 ]; then

    echo "<br />" >> index.html

    cnt=0

  fi

  cnt=`expr $cnt + 1`

done;