Skip to content

Instantly share code, notes, and snippets.

@man-oi
Created February 5, 2011 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save man-oi/812891 to your computer and use it in GitHub Desktop.
Save man-oi/812891 to your computer and use it in GitHub Desktop.
<?php
$images = array(); // Array-Variable definieren
$folder = "assets/images/about/";
$dir = openDir($folder);
while ($file = readDir($dir)) {
if ($file != "." && $file != ".." && !is_dir($file) && strpos($file, ".") > 0) {
if (strstr($file, ".gif") ||
strstr($file, ".png") ||
strstr($file, ".jpg")) {
$folder_file = $folder . $file;
array_push($images, array(fileMtime($folder_file), $folder_file));
}
}
}
closeDir($dir);
rsort($images); // Array sortieren
// Array auslesen und anzeigen
foreach ($images as $key => $value) {
echo '<img src="'.$images[$key][1].'" />';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment