// read images from directory
$dirName = './gallery/';
if ($handle = opendir ($dirName)) {
/* This is the correct way to loop over the directory. */
$images = array ();
while (false !== ($entry = readdir ($handle))) {
if (is_file ($dirName.$entry)) {
array_push ($images, $entry);
}
}
closedir ($handle);
if (count ($images)) {
sort ($images);
echo '
';
echo '';
}
}
?>