blob: 3dc8a8ca3d0f855d31e320c86e41aa712295a618 (
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<?php include("../boilerplate.php"); ?>
<title>/log/img</title>
<meta name="description" content="visual art">
<style>
.dir {
padding: 1rem;
padding-top: 2rem;
}
.dir article.imgs {
display: flex;
flex-wrap: wrap;
border-bottom: none;
padding: 0;
}
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>
<main 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.webp' alt='$im->alt'><span>$if >> $ist</span></a>".$op;
if($dc) {
$pmt = $mt;
}
}
echo "<h2>$pmt</h2><article class='imgs'>".$op;
?>
</main>
<p>$</p>
</body>
</html>
|