Here's the code for listing files from a directory without file-extension. Either keep only images in a directory or recognize desired file-extension only, ( using regular expressions! )
<?php
if ($handle = opendir('/~path_to_directory/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$page_name=substr($file, 0, strpos($file, "."));
echo "$page_name<br>";
}
}
}
closedir($handle);
?>