Migration of our hostname to lab.lostb.one is done. Redirects are intact until March.

Commit d99fdeec authored by Che's avatar Che

Decluttering update

- Removed option caption (was deprecated)
- Removed option ratio (was deprecated)
- Moved variables to the top of the file
parent dadb4256
......@@ -20,6 +20,7 @@ as seen in:
* backup directory
* Dependencies
* PHP Frontend
* Caching headers (moved to Web server configuration)
* Currently optimized for fullscreen use with a resolution of 1920x1080 pixels, thumbnail size of 24 ($size/parameter: size), 2769 thumbnails in the grid ($imgLimit/parameter: limit)
```
// fullpath is the pattern for selecting the images from the source directory
......@@ -63,8 +64,6 @@ gallery.php is the web frontend to the thumbnail collection and hopefully evolve
Integrated during development to play around with sizes and different views:
* `caption=y`: turn on captions
* `limit=2769`: use a limit of 2.769 images for the grid (accepts values between 400 and 4.000)
* `ratio=y`: preserve the image ratio
* `size=24`: use a thumbnail size of 24px (accepts values between 5 and 400)
* `refresh=n`: turn off the automatic refresh
<?php
// fullpath is the pattern for selecting the images from the source directory
$fullpath = "/var/www/gallery/thumbs/*@*.*";
// newbase defines the base path to use for the image links
$newbase = "thumbs/";
// The size in pixels used to draw thumbnails
$size = 24;
if (isset($_GET['size'])) {
$getSize = filter_var($_GET['size'], FILTER_SANITIZE_NUMBER_INT);
// Make sure the size of the thumbnails is between 5px and 400px.
if ($getSize >= 5 && $getSize <= 400) {
$size = $getSize;
}
}
// imgLimit defines the number of thumbnails which should be drawn
$imgLimit = 2769;
if (isset($_GET['limit'])) {
$getLimit = filter_var($_GET['limit'], FILTER_SANITIZE_NUMBER_INT);
// Make sure the grid is built out of between 400 and 4000 thumbnails.
if ($getLimit >= 400 && $getLimit <= 4000) {
$imgLimit = $getLimit;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
// Caching headers are now specified on server level.
if (!isset($_GET['refresh']) || filter_var($_GET['refresh'], FILTER_SANITIZE_STRING) != "n") {
echo" <meta http-equiv='refresh' content='300'>";
}
......@@ -34,16 +58,6 @@ if (!isset($_GET['refresh']) || filter_var($_GET['refresh'], FILTER_SANITIZE_STR
figure {
border: 1px dashed #555;
<?php
$size = 24;
if (isset($_GET['size'])) {
$getSize = filter_var($_GET['size'], FILTER_SANITIZE_NUMBER_INT);
// Make sure the size of the thumbnails is between 5px and 400px.
if ($getSize >= 5 && $getSize <= 400) {
$size = $getSize;
}
}
echo " width: " . $size . "px;\n";
echo " height: " . $size . "px;\n";
?>
......@@ -53,11 +67,6 @@ echo " height: " . $size . "px;\n";
figure img {
height: inherit;
<?php
if (!isset($_GET['ratio']) || filter_var($_GET['ratio'], FILTER_SANITIZE_STRING) != "y") {
echo " width: inherit;\n";
}
?>
line-height: inherit;
}
......@@ -144,14 +153,10 @@ if (!isset($_GET['ratio']) || filter_var($_GET['ratio'], FILTER_SANITIZE_STRING)
</style>
</head>
<body>
<!-- The Net.Art Generator Gallery containing up to 2.800 images! -->
<!-- GCB (d7dd0d), 2018 -->
<!-- The Net.Art Generator gallery extension -->
<!-- GCB (d7dd0d), 2019 -->
<div class="wrapImages">
<?php
// fullpath is the pattern for selecting the images from the source directory
$fullpath = "/var/www/gallery/thumbs/*@*.*";
// newbase defines the base path to use for the image links
$newbase = "thumbs/";
// we use GLOB_NOSORT since we don't want to sort based on the file name
$images = glob( $fullpath, GLOB_NOSORT );
// we sort the array ourselves: depending on file modification date
......@@ -159,24 +164,6 @@ usort($images, function($a, $b) {
return filemtime($a) < filemtime($b);
});
// imgLimit defines the number of thumbnails which should be drawn.
$imgLimit = 2769;
if (isset($_GET['limit'])) {
$getLimit = filter_var($_GET['limit'], FILTER_SANITIZE_NUMBER_INT);
// Make sure the grid is built out of between 400 and 4000 thumbnails.
if ($getLimit >= 400 && $getLimit <= 4000) {
$imgLimit = $getLimit;
}
}
// Don't use captions by default.
$useCaption = false;
if (isset($_GET['caption'])) {
if (filter_var($_GET['caption'], FILTER_SANITIZE_STRING) == "y") {
$useCaption = true;
}
}
// curVal holds the current value of iterations while building the grid.
$curVal = 0;
foreach ($images as $image) {
......@@ -192,14 +179,6 @@ foreach ($images as $image) {
$entry = "<figure><img src='" . $newbase . $child . "' alt='" . $author . ": " . $title . "'></figure>";
if ($useCaption) {
$expStamp = explode("_", pathinfo($expChild[1])['filename']);
$expTime = explode(".", $expStamp[2]);
$timestamp = $expStamp[1] . " " . $expStamp[0] . " " . $expStamp[3] . ", " . $expTime[0] . ":" . $expTime[1] . ":" . $expTime[2];
$entry = "<figure><img src='" . $newbase . $child . "' alt='" . $author . ": " . $title . "'><figcaption>" . $author . ": " . $title . "<br>" . $timestamp . "</figcaption></figure>";
}
echo $entry;
$curVal++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment