/** * This file: images.php * This script read content of "images" directory as same level, and return filelist in array format **/ $dir = "bilder/"; $images = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($dir){ if(in_array($file, array('.', '..')) == FALSE){ $images[] = $file; } } } closedir($dh); } } /** * Print array to browswer */ echo '
';
print_r($images);

 /**
  * Iterate $images array in foreach loop and display images with img tag (need to adjust directory to your needs).
  */
foreach ($images as $key => $image){
    echo 'image_'.$key.'';
}