/* settings */
$image_dir = 'images/';
$per_column = 6;
/* step one: read directory, make array of files */
if ($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..')
{
if(strstr($file,'-thumb'))
{
$files[] = $file;
}
}
}
closedir($handle);
}
/* step two: loop through, format gallery */
if(count($files))
{
foreach($files as $file)
{
$count++;
echo '

';
if($count % $per_column == 0) { echo '
'; }
}
}
else
{
echo '
There are no images in this gallery.
';
}
?>