Have fun with it:
#!/bin/bash
######################
# Set Variables
######################
ENDING=jpg;
IMG_SIZE=800;
THUMB_SIZE=150;
DIR=folder/folder/images/;
ID=/usr/bin/identify;
######################
# Create Thumbnail
######################
ls -1 *.$ENDING | grep -v thb |while read file;
do convert -thumbnail $THUMB_SIZEx$THUMB_SIZE "$file" "`basename _thb_"$file"`";
echo "---> _thb_$file created";
done
######################
# Convert image
######################
ls -1 *.$ENDING | grep -v thb | while read file;
do convert -resize $IMG_SIZEx$IMG_SIZE "$file" "`basename "$file"`";
echo "---> $file converted";
done
######################
# Output HTML-Code
######################
echo "######################";
echo "HTML-CODE:";
echo "######################";
ls -1 *.$ENDING | grep -v thb | while read file;
do
h=$($ID -format \"%h\" "`basename _thb_"$file"`");
w=$($ID -format \"%w\" "`basename _thb_"$file"`");
echo "<a href=\""$DIR$file"\">";
echo "<img alt=\"\" src=\""$DIR""`basename _thb_"$file"`"\" width=$w height=$h /></a>";
done
echo "######################";
bashconverthtmlimagethumbnail