img
$folder = 'img/';
$filetype = '*.*';
$files = glob($folder.$filetype);
$count = count($files);
echo '<table>';
for ($i = 0; $i < $count; $i++) {
echo '<tr><td>';
echo '<a name="'.$i.'" href="#'.$i.'"><img src="'.$files[$i].'" /></a>';
echo '<h2>';
echo substr($files[$i],strlen($folder),strpos($files[$i], '.')-strlen($folder));
echo '</h2>';
echo '</td></tr>';
}
echo '</table>';