#! /usr/bin/perl -w


$dir = "./";
$folder_link = "misc";
$image_counter = 0;

open( OUTPUT, ">./image_html.txt" );
opendir( IMAGE_DIR, $dir );

	@images = grep { not m/small_/ } readdir IMAGE_DIR;
	@images = grep { m/.JPG$/ } @images;

	print OUTPUT "<table  border=\"1\" cellpadding=\"15\" cellspacing=\"0\" bordercolor=\"\#000000\">\n\t<tr>\n";

	foreach $image ( @images )
	{
		if( $image_counter == 3 )
		{
			print OUTPUT "</tr>\n\t<tr>\n";
			$image_counter = 0;
		}

		$small_image = $image;
		$small_image = "small_" . $image;
		$small_image =~ s/\.JPG/\.jpg/;

		print OUTPUT "\t\t<td align=\"left\" valign=\"top\"><a href=\"graphics/$folder_link/$image\" target=\"_blank\"><img src=\"graphics/$folder_link/$small_image\" border=\"2\"></a></td>\n";

		$image_counter++;
	}

	print OUTPUT "\t</tr>\n</table>\n";

closedir( IMAGE_DIR );
close( OUTPUT );

exit;