// obtain list of images and output the HTML
$dir = opendir("flashpix");
$files = array();
while ($files[] = readdir($dir));
closedir($dir);
sort($files);
foreach ($files as $file) {
if(preg_match('/\d{1,3} ?(.*)\.jpg/i', $file, $matches)) {
$cfile = str_replace('_', ' ', $matches[1]); echo '
'.PHP_EOL; } } // end foreach ?>