foto: keep static images of height 250
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 24 Oct 2019 04:58:04 +0000 (06:58 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 21 Nov 2019 19:00:01 +0000 (20:00 +0100)
Drop dynamic source replacement to match actual client sizes, as the quality
loss from downsizing a _larger_ image is minimal.

Originally introduced in lijtweg commit v2.5-7-gcd93e774e6 (2017-10-11)
[foto: replace justified thumbnails by height-optimised versions]
with visible improvements probably due to using the target size of 200px
without adjusting for up to 1.25x enlargement to fit.

Testing originals of 250px on modern browsers with (bilinear) rescaling
is hard to distinguish (not significantly more blurry) and depends on only
a single thumbnail resolution to be created for significantly reduced
resource requirements.  May be slightly larger on average, but likely much
smaller without reloads and considering caching opportunities.

foto/album.inc.php
foto/index.php

index 42061d7624f805fa0807df62267d6e27dd652b55..7a3f917afbab757e6f3e81a0ea1efb922a69e8eb 100644 (file)
@@ -74,7 +74,6 @@ function imgjustify() {
                targetRowHeight: 200,
        };
        var layout = require('justified-layout')(ratios, config);
-       var thumbreplace = !/[?&]blur\b/.test(window.location.search);
 
        gallery.style.position = 'relative';
        gallery.style.height = layout.containerHeight + 'px';
@@ -86,20 +85,6 @@ function imgjustify() {
                        imgel.style.position = 'absolute';
                        imgel.style.top = layout.boxes[i].top + 'px';
                        imgel.style.left = layout.boxes[i].left + 'px';
-
-                       if (thumbreplace) {
-                               var thumbtarget = imgel.src.replace(/(\/thumb\/)\d+/, '$1'+layout.boxes[i].height)
-                               if (imgel.complete) {
-                                       imgel.src = thumbtarget;
-                               }
-                               else if (thumbtarget != imgel.src) {
-                                       var loadthumb = new Image();
-                                       loadthumb.src = thumbtarget;
-                                       loadthumb.onload = function() {
-                                               imgel.src = this.src;
-                                       };
-                               }
-                       }
                })();
        }
 };
index d3e989873ca9c3491f9875c864b6e1ca5c4e8531..e9b9521f76b6e5fc36e3094ab6a6d9865c3022f8 100644 (file)
@@ -36,7 +36,7 @@ function showthumb($path)
 {
        // assume all album entries are symlinks to archive originals
        $target = preg_replace('{^(\.\./)*}', '', readlink($path));
-       $thumb = 'thumb/200/' . $target;
+       $thumb = 'thumb/250/' . $target;
 
        @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
        $imgtag = 'img src="/'.$thumb.'"';