aboutsummaryrefslogtreecommitdiff
path: root/img/index.php
blob: 0240275614f4cec9640a885a840b50826c5eb9dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>/log/img</title>
    <link href="../style.css" rel="stylesheet" type="text/css" media="all">
    <?php include("../seasonal.php");
    
    ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_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;
        word-break: break-word;
      }
      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
      $fp = "/var/www/data/deeptwisty/images.json";
      $images = json_decode(file_get_contents($fp));
      $pmt = "";
      $op = "";
      foreach($images as $if=>$im) { // Loops through each image and echoes it to the page

        $no = substr($if, 0, strpos($if, ".")); // Filename with extension stripped
        $mt = date("Y-m-d", $im->date); // File modification date in ISO format
        $ist = $im->x . "×" . $im->y; // Image size formatted as X×Ypx
        
        $dc = false;
        if($pmt != $mt) { $dc = true; }// date change

        /*if($pmt != $mt) {
          $pmt = $mt;
          $op = "<h2>$mt</h2><article class='imgs'>".$op;
          if($pmt != "") {
            $op = "</article>".$op;
          }
        }*/

        if($dc and $pmt) { $op = "<h2>$pmt</h2><article class='imgs'>".$op; }
        if($dc) { $op = "</article>".$op; }
        $op = "<a class='img' href='/img/$if'><img src='/img/thumbs/$no.jpg' alt='$im->alt'><span>$if >> $ist</span></a>".$op;
        

        if($dc) {
          $pmt = $mt;
        }
      }
      echo "<h2>$pmt</h2><article class='imgs'>".$op;
    ?>
  </section>
  <p>$</p>
  </body>

</html>