foto: ?blur option to disable thumbnail resizing
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 19 Jun 2018 11:10:26 +0000 (13:10 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 19 Jun 2018 18:57:08 +0000 (20:57 +0200)
foto/album.inc.php

index 5e1a14845fe6a3a0a62d54bb3f6012aca9674c5f..94100835dac88ba958f9440c06349a2d8a7c68d1 100644 (file)
@@ -74,6 +74,7 @@ function imgjustify() {
                targetRowHeight: 200,
        };
        var layout = require('justified-layout')(ratios, config);
+       var thumbreplace = !window.location.search.test(/[?&]blur\b/);
 
        gallery.style.position = 'relative';
        gallery.style.height = layout.containerHeight + 'px';
@@ -86,16 +87,18 @@ function imgjustify() {
                        imgel.style.top = layout.boxes[i].top + 'px';
                        imgel.style.left = layout.boxes[i].left + 'px';
 
-                       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;
-                               };
+                       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;
+                                       };
+                               }
                        }
                })();
        }