X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FImage.pm;h=f4262e305df8e2773d97c19cb4017ac0de8900cc;hp=da45cfbd098571baece177482b5f795549c2d04f;hb=acc5b53241d0e971595d6017c60f54a6bc057c41;hpb=ea1ebc654e8c7094e14337fcab673e3cdfad700a diff --git a/perl/Sesse/pr0n/Image.pm b/perl/Sesse/pr0n/Image.pm index da45cfb..f4262e3 100644 --- a/perl/Sesse/pr0n/Image.pm +++ b/perl/Sesse/pr0n/Image.pm @@ -14,20 +14,21 @@ sub handler { # } # Find the event and file name - my ($event,$filename,$xres,$yres); + my ($event,$filename,$xres,$yres,$dpr); my $infobox = 'both'; if ($r->uri =~ m#^/([a-zA-Z0-9-]+)/original/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) { $event = $1; $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+)/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) { + } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/(\d+)x(\d+)(?:\@(\d+))?/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) { $event = $1; - $filename = $5; + $filename = $6; $xres = $2; $yres = $3; - $infobox = 'nobox' if (defined($4) && $4 eq 'nobox/'); - $infobox = 'box' if (defined($4) && $4 eq 'box/'); + $dpr = $4; + $infobox = 'nobox' if (defined($5) && $5 eq 'nobox/'); + $infobox = 'box' if (defined($5) && $5 eq 'box/'); } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/((?:no)?box/)?([a-zA-Z0-9._()-]+)$#) { $event = $1; $filename = $3; @@ -36,6 +37,7 @@ sub handler { $infobox = 'nobox' if (defined($2) && $2 eq 'nobox/'); $infobox = 'box' if (defined($2) && $2 eq 'box/'); } + $dpr //= 1; my ($id, $dbwidth, $dbheight); #if ($event eq 'single' && $filename =~ /^(\d+)\.jpeg$/) { @@ -52,7 +54,7 @@ sub handler { $dbheight = $ref->{'height'}; # Scale if we need to do so - my ($fname, $mime_type) = Sesse::pr0n::Common::ensure_cached($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres); + my ($fname, $mime_type) = Sesse::pr0n::Common::ensure_cached($r, $filename, $id, $dbwidth, $dbheight, $infobox, $dpr, $xres, $yres); # Output the image to the user if (!defined($mime_type)) {