#! /bin/sh

DIRNAME=`pwd`
DIRNAME=`basename $DIRNAME`
cat >index.html <<EOF
<html>
 <head>
  <title>$DIRNAME</title>
 <body>
  <h1>$DIRNAME</h1>

EOF
for file in *; do
    [ "$file" = "index.html" ] && continue
    BASE=`basename "$file" | sed 's/\.[^.]*$//'`
    convert -scale 250x250 "${file}" "${BASE}.mini.jpeg"
    echo '<a href='\""${file}"\"'><img src='\""${BASE}.mini.jpeg"\"' border=0></a>' >>index.html
done

cat >>index.html <<EOF
 </body>
</html>
EOF
