diff options
| author | Ada Isopods <me@bathynomus.xyz> | 2023-03-16 23:38:54 -0600 |
|---|---|---|
| committer | Ada Isopods <me@bathynomus.xyz> | 2026-10-21 23:30:19 -0600 |
| commit | 683dfaab7247bfe6fdd989de203f91e68b509a22 (patch) | |
| tree | c127128e7f21352734788bcc878e0c81cceaabf7 /art/index.php | |
| parent | 68742fef9c5148247e4eaa429535c9db02285dcd (diff) | |
showing support for the unionization efforts at bandcamp
Diffstat (limited to 'art/index.php')
| -rw-r--r-- | art/index.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/art/index.php b/art/index.php index ae7da21..0a54249 100644 --- a/art/index.php +++ b/art/index.php @@ -1,3 +1,8 @@ +<!--?php +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); +?--> <!DOCTYPE html> <html> <head> @@ -81,19 +86,29 @@ <body> <div class="flex-container"> <?php + $imagetimes = Array(); + function test_image($name) { // Returns true if a file is an image (png or gif), false otherwise return (strpos($name, ".png") > 0 or strpos($name, ".gif") > 0); } + function imagetime($file) { // This needs to return a Unix timestamp. + global $imagetimes; + if(!$imagetimes[$file]) { + $imagetimes[$file] = filemtime($file); + } + return $imagetimes[$file]; + } + $images = array_filter(scandir("."), "test_image"); // Generate array of every image in the directory by filename usort($images, function($a, $b) { // Sort images by modification date of the files - return filemtime("$b") - filemtime("$a"); + return imagetime("$b") - imagetime("$a"); }); $datecounts = array(); foreach($images as $im) { // Generate list of dates and how many images have them - $mt = date("Y-m-d", filemtime("$im")); // File modification date in ISO format + $mt = date("Y-m-d", imagetime("$im")); // File modification date in ISO format if($datecounts[$mt]) { $datecounts[$mt]++; } else { @@ -105,7 +120,7 @@ foreach($images as $im) { // Loops through each image and echoes it to the page $no = substr($im, 0, strpos($im, ".")); // Filename with extension stripped - $mt = date("Y-m-d", filemtime("$im")); // File modification date in ISO format + $mt = date("Y-m-d", imagetime("$im")); // File modification date in ISO format $is = getimagesize("$im"); $ist = $is[0] . "×" . $is[1] . "px"; // Image size formatted as X×Ypx @@ -120,7 +135,7 @@ echo "<label for='show$mt'><a style='background-image:url(thumbs/$tn.png);'><span>...</span></a></label>"; $pmt = $mt; } - $cl = " class='d$mt'"; + $cl = " class='d$mt'"; } echo "<a href='$im' style='background-image:url(thumbs/$no.png);'$cl><span>$im<br>$mt • $ist</span></a>"; |
