From: Mischa POSLAWSKY Date: Thu, 24 Oct 2019 04:58:04 +0000 (+0200) Subject: foto: keep static images of height 250 X-Git-Tag: v4.2~11 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/e3be85e24011ce42b9c48e19a21b9e7faba72767?hp=8dfcd9f98a316599cae7d94f56069c4ba79d2c93 foto: keep static images of height 250 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. --- diff --git a/foto/album.inc.php b/foto/album.inc.php index 42061d7..7a3f917 100644 --- a/foto/album.inc.php +++ b/foto/album.inc.php @@ -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; - }; - } - } })(); } }; diff --git a/foto/index.php b/foto/index.php index d3e9898..e9b9521 100644 --- a/foto/index.php +++ b/foto/index.php @@ -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.'"';