#!/bin/bash

# this script gets execute inside of photos/master, so use
# paths relative to there.

# short name of directory
short_name=$1

picture_dir=pictures/$short_name
thumb_dir=thumbs/$short_name
html_file=html/$short_name.html

echo "<html><body>" > $html_file

listing=`ls $picture_dir`
x="one"
for f in $listing
do
	echo "<a href=\"../$picture_dir/$f\"><img src=\"../$thumb_dir/tn_$f\"/></a>" >> $html_file
	if [ $x = "one" ]
	then
		x="two"
	else
		x="one"
		echo "<br/>" >> $html_file
	fi
done

echo "</body></html>" >> $html_file
