diff options
| author | Ada Isopods <me@bathynomus.xyz> | 2024-12-05 20:26:58 -0700 |
|---|---|---|
| committer | Ada Isopods <me@bathynomus.xyz> | 2026-10-21 23:30:20 -0600 |
| commit | e0406f8c60a05887c2670d633d1d8eb58c7332c1 (patch) | |
| tree | 77fd790ff67921e35f5c0f10a1c1e375a5b4d566 /v3/img/index.php | |
| parent | b58b9832183c5dec8af2dfd580abf3d5d9bdc086 (diff) | |
overhauled the entire site basically
Diffstat (limited to 'v3/img/index.php')
| -rw-r--r-- | v3/img/index.php | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/v3/img/index.php b/v3/img/index.php deleted file mode 100644 index a6cc9fa..0000000 --- a/v3/img/index.php +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="icon" type="image/x-icon" href="/favicon.ico"> - <title>/log/img</title> - <link href="../style.css" rel="stylesheet" type="text/css" media="all"> - <style> - .dir { - padding: 1rem; - padding-top: 2rem; - } - article.imgs { - display: flex; - flex-wrap: wrap; - border-bottom: none; - } - a.img { - display: flex; - flex-direction: column; - } - a.img :is(img, span) { - margin: 1rem; - } - h2 { - margin: 1rem; - margin-bottom: 0; - } - </style> - </head> - <body> - <nav><a href="../"><<<</a></nav> - <p>$ pwd</p> - <h1 class="title">/log/img</h1> - <p>$ ls -t</p> - <section class="dir"> - <?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 or strpos($name, ".jxl") > 0); - } - - function imagetime($file) { // This needs to return a Unix timestamp. - global $imagetimes; - if(!$imagetimes[$file]) { - $imagetimes[$file] = filemtime("../../art/".$file); - } - return $imagetimes[$file]; - } - - $images = array_filter(scandir("../../art"), "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 imagetime("$b") - imagetime("$a"); - }); - - $pmt = ""; - 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", imagetime("$im")); // File modification date in ISO format - $is = getimagesize("../../art/$im"); - $ist = $is[0] . "×" . $is[1]; // Image size formatted as X×Ypx - - if($pmt != $mt) { - $pmt = $mt; - if($pmt != "") { - echo "</article>"; - } - echo "<h2>$mt</h2><article class='imgs'>"; - } - - echo("<a class='img' href='/img/$im'><img src='/img/thumbs/$no.jpg'><span>$im >> $ist</span></a>"); - } - ?> - </section> - <p>$</p> - </body> - -</html> |
