Handle non-integral device pixel ratios.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 20 Oct 2015 19:49:11 +0000 (21:49 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 20 Oct 2015 20:01:26 +0000 (22:01 +0200)
files/pr0n-fullscreen.js
perl/Sesse/pr0n/Image.pm
perl/Sesse/pr0n/pr0n.pm

index 79c174b72c35f36c0918bc8a0ec1f073c56f6c5b..789cda741f5c15ab6f4c88e31dba5489ff0025a5 100644 (file)
@@ -174,7 +174,7 @@ function display_image(width, height, evt, filename, element_id)
                if (dpr == 1) {
                        url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "/box/" + filename;
                } else {
-                       url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "@" + dpr + "/box/" + filename;
+                       url = "http://" + global_vhost + "/" + evt + "/" + width + "x" + height + "@" + dpr.toFixed(2) + "/box/" + filename;
                }
                var boximg = replace_image_element(url, element_id + "_box", main);
 
index f4262e305df8e2773d97c19cb4017ac0de8900cc..372a9b19e5756a2ca85bd44949c5c2e2b623c7e0 100644 (file)
@@ -21,7 +21,7 @@ sub handler {
                $filename = $3;
                $infobox = 'nobox' if (defined($2) && $2 eq 'nobox/');
                $infobox = 'box' if (defined($2) && $2 eq 'box/');
-       } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/(\d+)x(\d+)(?:\@(\d+))?/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) {
+       } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/(\d+)x(\d+)(?:\@(\d+(?:\.\d+)?))?/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) {
                $event = $1;
                $filename = $6;
                $xres = $2;
index 74d34f3a0f4b7f133308bcaa2d8f7d633882a487..939139808aa6315bd5fb44db07584d095f276b7a 100644 (file)
@@ -66,7 +66,7 @@ sub handler {
                 $uri =~ /^\/\+all\/?$/ ||
                 $uri =~ /^\/\+tags\/[a-zA-Z0-9-]+\/?$/) {
                return Sesse::pr0n::Index::handler($r);
-       } elsif ($uri =~ m#^/[a-zA-Z0-9-]+/(\d+x\d+(\@\d+)?/|original/)((?:no)?box/)?[a-zA-Z0-9._()-]+$#) {
+       } elsif ($uri =~ m#^/[a-zA-Z0-9-]+/(\d+x\d+(\@\d+(\.\d+)?)?/|original/)((?:no)?box/)?[a-zA-Z0-9._()-]+$#) {
                return Sesse::pr0n::Image::handler($r);
        }