Created
October 21, 2017 09:49
-
-
Save dgtlmoon/4740655e4f568a17147d0ecfe99e649d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<!--[if IE]> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<![endif]--> | |
<meta charset="utf-8"> | |
<title>Gallery</title> | |
<link rel="stylesheet" href="css/blueimp-gallery.css"> | |
<link rel="stylesheet" href="css/blueimp-gallery-indicator.css"> | |
<link rel="stylesheet" href="css/blueimp-gallery-video.css"> | |
<link rel="stylesheet" href="css/demo/demo.css"> | |
</head> | |
<body> | |
<h2>Image gallery: <?php print filter_var(file_get_contents("./info.txt"), FILTER_SANITIZE_STRING); ?></h2> | |
<!-- The container for the list of example images --> | |
<div id="links" class="links"> | |
<?php | |
$sdirs = []; | |
// Look in each directory, use the first image we find as the timestamp to sort the directory list by | |
foreach(scandir('.') as $directory) { | |
if(preg_match("/[a-z]/i", $directory)) { | |
if(is_dir($directory)) { | |
$files = scandir($directory); | |
// keep going till we hit something | |
foreach($files as $file) { | |
$exif = @exif_read_data("{$directory}/{$files[3]}", 'IFD0'); | |
if($exif && isset($exif['DateTime'])) { | |
$date = strtotime($exif['DateTime']); | |
$sdirs[$date] = array("dir"=>$directory, "name"=> strftime("%e %B %Y", $date), "img"=> "{$directory}/thumbnails/{$files[3]}"); | |
break; | |
} | |
} | |
} | |
} | |
} | |
ksort($sdirs); | |
?> | |
<?php | |
foreach($sdirs as $dir) { | |
print "<h4>{$dir['name']}</h4><a href=\"./{$dir['dir']}/index.php\"> <img src=\"{$dir['img']}\" > </a>\n"; | |
} | |
?> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment