<?
$allowed_types = array('png','jpg','jpeg','gif');
$dir="img/photo/";
$i=1;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
echo "<table border=\"0\"><tr>";
while (($file = readdir($dh)) !== false) {
if(in_array(strtolower(substr($file,-3)),$allowed_types))
{
$size = getimagesize($dir.$file);
//echo $size[0];
echo "<td><div class=\"thumb_img\"><a href=\"#\"><img src=\"$dir$file\" width=\"110\" alt=\"$file\" onclick=\"javascript
:window.open('view.php?path=$d ir$file','_blank','tollbar=0')\" border=\"0\" /></a></div></td>";
if (($i % 4)==0 && $i!=0) {echo "</tr><tr>";}
$i++;
}
}
echo "</table>";
closedir($dh);
}
}
?>