Hi,
I’m reasonably new to php, I’m trying to display a list of file names including the file type from a directory containing images. The problem I have is I don’t want to show the sub directories, or if possible set it to only show the image files only, my code is below and the specific questions underneath.
[php]
$dir = $_SERVER[‘DOCUMENT_ROOT’] . ‘/images/Gallery/’;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != “.” && $file != “…” && $file !=filetype($file)) {
echo “
”;
}
}
}
closedir($handle);
[/php]
Questions:
What do I need to add with the exclude ‘.’ And ‘…’ To exclude folders in this directory, if possible?
Otherwise is there a way to only display all image files rather then having to specify all the ‘.png’ ‘.jpg’ etc?