<?php

// Penguin Gallery http://www.penguintutor.com/penguingallery 
// Copyright 2009 Stewart Watkiss
/*  
	This file is a part of Penguin Gallery

	Penguin Gallery is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Penguin Gallery is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Penguin Gallery.  If not, see <http://www.gnu.org/licenses/>.
*/

// Gallerythumb.php
// Displays thumbnails

// Test filenames is array (ie. we have some images to show) and that the selected image is within range
if (is_array($filenames) && sizeof($filenames) >= $largeimg)
{
	
	$imgcount = 1;
	foreach ($filenames as $thisfile) 
	{
		echo "<div class=\"thumbframe\">\n";
		echo "<a class=\"imglink\" href=\"$thisurl&img=$imgcount\" onclick=\"changeimg($imgcount); return false;\"><img class=\"thumbimg\" src=\"$viewthumb$thisfile.jpg\" alt=\"$thisfile\" /></a>\n";
		echo "<p class=\"imglabel\"><a class=\"imgtitlelink\" href=\"$thisurl&img=$imgcount\" onclick=\"changeimg($imgcount); return false;\">$thisfile</a></p>\n";
		echo "</div>\n";
		$imgcount++;
	}
}
// Different error if no array vs. image not found
elseif (sizeof($filenames) < $largeimg) 
{
	echo "<p>Photo requested is out of range</p>";
}
// Otherwise no photos found
else 
{
	echo "<p>Sorry no photos found in directory - $directory</p>";
}



?>
