#!/bin/bash
#Sets the width in pixels for the generetad thumbnail.
image_width=200
#The name of the file to get the generated html code
filename=index.html
for i in $(ls |grep -i .png | grep -v thumb);
do
if ! [ -f thumb.$i ]
then convert -thumbnail x$image_width $i thumb.$i;
fi
done
for i in $(ls |grep -i .jpg | grep -v thumb);
do
if ! [ -f thumb.$i ]
then convert -thumbnail x$image_width $i thumb.$i;
fi
done
find -maxdepth 1 -iname "*\.jpg" -exec echo "" \; | grep thumb | sed "s#href=\"\./thumb\.#href=\"#g" > $filename
find -maxdepth 1 -iname "*\.png" -exec echo "" \; | grep thumb | sed "s#href=\"\./thumb\.#href=\"#g" >> $filename