aboutsummaryrefslogtreecommitdiff
path: root/img/index.php
diff options
context:
space:
mode:
authorAda Isopods <me@bathynomus.xyz>2026-10-21 23:29:29 -0600
committerAda Isopods <me@bathynomus.xyz>2026-10-21 23:30:36 -0600
commit2ac93c5be73455a9f9ea3d53b300385078f9008b (patch)
treec06ad45be3246fc6fe862228e1a407d0d3734db5 /img/index.php
parentc588388e1a66c326a30de15dded84a80ddbab67a (diff)
forgotHEADmain
Diffstat (limited to 'img/index.php')
-rwxr-xr-ximg/index.php66
1 files changed, 32 insertions, 34 deletions
diff --git a/img/index.php b/img/index.php
index 7b4f61b..0240275 100755
--- a/img/index.php
+++ b/img/index.php
@@ -5,7 +5,11 @@
<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"); ?>
+ <?php include("../seasonal.php");
+
+ ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);?>
<style>
.dir {
padding: 1rem;
@@ -19,6 +23,7 @@
a.img {
display: flex;
flex-direction: column;
+ word-break: break-word;
}
a.img :is(img, span) {
margin: 1rem;
@@ -36,45 +41,38 @@
<p>$ ls -t</p>
<section class="dir">
<?php
- $imagetimes = Array();
+ $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
- 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);
- }
+ $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
- function imagetime($file) { // This needs to return a Unix timestamp.
- global $imagetimes;
- if(!$imagetimes[$file]) {
- $imagetimes[$file] = filemtime($file);
+ /*if($pmt != $mt) {
+ $pmt = $mt;
+ $op = "<h2>$mt</h2><article class='imgs'>".$op;
+ if($pmt != "") {
+ $op = "</article>".$op;
}
- 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 imagetime("$b") - imagetime("$a");
- });
+ }*/
- $pmt = "";
- foreach($images as $im) { // Loops through each image and echoes it to the page
+ 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;
+
- $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("$im");
- $ist = $is[0] . "×" . $is[1]; // Image size formatted as X×Ypx
-
- if($pmt != $mt) {
- if($pmt != "") {
- echo "</article>";
- }
- $pmt = $mt;
- 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>");
+ if($dc) {
+ $pmt = $mt;
}
- ?>
+ }
+ echo "<h2>$pmt</h2><article class='imgs'>".$op;
+ ?>
</section>
<p>$</p>
</body>