]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Fix display of long shutter times.
[pr0n] / perl / Sesse / pr0n / Common.pm
index 34ee8d9c7abcd2f58dced0d6001553c209e358f6..2ab7b3ae242569976891f1e104d144a0622e5e4b 100644 (file)
@@ -39,7 +39,7 @@ BEGIN {
                require Sesse::pr0n::Config_local;
        };
 
-       $VERSION     = "v2.70";
+       $VERSION     = "v2.71";
        @ISA         = qw(Exporter);
        @EXPORT      = qw(&error &dberror);
        %EXPORT_TAGS = qw();
@@ -338,7 +338,8 @@ sub output_401 {
        $r->status(401);
        $r->headers_out->{'www-authenticate'} = 'Basic realm="pr0n.sesse.net"';
 
-       if ($options{'DigestAuth'} // 1) {
+       # Digest auth is disabled for now, due to various client problems.
+       if (0 && ($options{'DigestAuth'} // 1)) {
                # We make our nonce similar to the scheme of RFC2069 section 2.1.1,
                # with some changes: We don't care about client IP (these have a nasty
                # tendency to change from request to request when load-balancing
@@ -795,16 +796,9 @@ sub ensure_cached {
                        my $height = $img->Get('rows');
                        my ($nwidth, $nheight) = scale_aspect($width, $height, $xres, $yres);
 
-                       # Use lanczos (sharper) for heavy scaling, mitchell (faster) otherwise
-                       my $filter = 'Mitchell';
-                       my $quality = 90;
-                       my $sf = undef;
-
-                       if ($width / $nwidth > 8.0 || $height / $nheight > 8.0) {
-                               $filter = 'Lanczos';
-                               $quality = 85;
-                               $sf = "1x1";
-                       }
+                       my $filter = 'Lanczos';
+                       my $quality = 87;
+                       my $sf = "1x1";
 
                        if ($xres != -1) {
                                $cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter, 'sampling-factor'=>$sf);
@@ -885,7 +879,7 @@ sub make_infobox {
                my ($a, $b) = ($1, $2);
                my $gcd = gcd($a, $b);
                push @classic_fields, [ $a/$gcd . "/" . $b/$gcd . "s", $shutter_priority ];
-       } elsif (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+(?:\.\d+))$/) {
+       } elsif (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+(?:\.\d+)?)$/) {
                push @classic_fields, [ $1 . "s", $shutter_priority ];
        }
 
@@ -921,7 +915,7 @@ sub make_infobox {
 
        if (defined($info->{'ExposureBiasValue'}) && $info->{'ExposureBiasValue'} ne "0") {
                push @classic_fields, [ $info->{'ExposureBiasValue'} . " EV", 0 ];
-       } elsif (defined($info->{'ExposureCompensation'}) && $info->{'ExposureCompensation'} != 0) {
+       } elsif (defined($info->{'ExposureCompensation'}) && $info->{'ExposureCompensation'} ne "0") {
                push @classic_fields, [ $info->{'ExposureCompensation'} . " EV", 0 ];
        }