mroddball
By: a guest | Sep 29th, 2009 | Syntax:
PHP | Size: 1.55 KB | Hits: 51 | Expires: Never
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Gallery</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
table {margin: 1px auto;border: 1px solid black;background-color: #DCDCDC;}
img {border: 1px solid #778899;margin: 7px}
body {background-color: #FFFFE0;}
</style>
</head>
<body>
<table>
<tr>
<?php
//Only files with these extensions
$accept_ext=array("JPG","TIFF","PNG");
$how_many_images_in_row=4;
$i=0;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
}
}
}
//It's better to sort it by file name, usually they come
// out in alphabetical order, but sometimes they don't...
foreach($file_list as $file){
?>
<td><a href="<?=$file?>"><img alt="<?=$file?>" src="thumb/<?=$file?>"/></a></td>
<?php
$i++;
if($i!=count($file_list) && !($i%$how_many_images_in_row)){
?>
</tr>
<tr>
<?php
}elseif($i==count($file_list)){
?>
</tr>
<?php
}
}
}
?>
</table>
</body>
</html>