[eluser]learning_php[/eluser]
Hi,
I have written a basic image gallery but it loads a thumbs.db file which is located in the thumbs folder. How do I define which types of file to display?
Code:
<?php
$images = "thumbs/"; # Location of small versions
$big = "uploads/";
$cols = 5; # Number of columns to display
if ($handle = opendir($images)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
$files[] = $file;
}
}
closedir($handle);
}
$colCtr = 0;
echo '<table width="100%" cellspacing="0"><tr>';
foreach($files as $file)
{
if($colCtr %$cols == 0)
echo '</tr><tr><td colspan="5"><hr /></td></tr><tr>';
echo '<td align="center"><a href="'. $big . $file . '"><img src="' . $images . $file . '" /></a></td>';
$colCtr++;
}
echo '</table>' . "\r\n";
?>