#!/bin/bash

#Print header
cat << EOF > thumbnails.html

<HTML>
<HEAD><TITLE>Bild-index från $PWD</TITLE></HEAD>
<BODY BGCOLOR=#181D64>

These are all images from <A HREF="http://www.trond.com/brazil">a Brazil
homepage</A>, and I just wanted them collected in a thumbnail gallery.<P>

Brazil - it is a great movie, bizzare and hillarious. For more information
on it, read the homepage.<P>

<CENTER>
<TABLE BORDER=0 CELLSPACING=3 CELLPADDING=5>
<TR>
EOF

COUNTER=0

#Print one line for each thumbnail
for i in m_*.jpg
do
	COUNTER=`expr $COUNTER + 1`
	FIL=`echo $i | cut -b 3-`
	echo "	<TD VALIGN=MIDDLE ALIGN=CENTER><A HREF=\"$FIL\"><IMG SRC=\"$i\" BORDER=0></A><BR>" >> thumbnails.html
	echo >> thumbnails.html
	echo "	</TD>" >> thumbnails.html

	if `test $COUNTER = 5`; then
		echo "</TR>" >> thumbnails.html
		echo "<TR>" >> thumbnails.html
		COUNTER=0
	fi
done

#Print footer
cat << EOF >> thumbnails.html
</TR>
</TABLE><P>
</CENTER>
</BODY>
</HTML>
EOF


