X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=52d6ee2f61544c5101dc52a83905b0a2a746b764;hb=f6116b9cd29ee1a171dd21523ced708e54262b12;hp=8a881e3a3ff68bcb9e873a5975302c58b800920e;hpb=29f1fc41da78a3cb8177e28d0579453c8d6ecc4e;p=pr0n diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index 8a881e3..52d6ee2 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -32,7 +32,7 @@ BEGIN { require Sesse::pr0n::Config_local; }; - $VERSION = "v3.02"; + $VERSION = "v3.20"; @ISA = qw(Exporter); @EXPORT = qw(&error &dberror); %EXPORT_TAGS = qw(); @@ -207,20 +207,20 @@ sub get_dbh { sub get_disk_location { my ($r, $id) = @_; - my $dir = POSIX::floor($id / 256); + my $dir = POSIX::floor($id / 256); return $Sesse::pr0n::Config::image_base . "images/$dir/$id.jpg"; } sub get_cache_location { - my ($r, $id, $width, $height) = @_; - my $dir = POSIX::floor($id / 256); + my ($id, $width, $height) = @_; + my $dir = POSIX::floor($id / 256); return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-nobox.jpg"; } sub get_infobox_cache_location { - my ($r, $id, $width, $height, $dpr) = @_; - my $dir = POSIX::floor($id / 256); + my ($id, $width, $height, $dpr) = @_; + my $dir = POSIX::floor($id / 256); if ($dpr == 1) { return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-box.png"; @@ -248,7 +248,7 @@ sub ensure_disk_location_exists { sub get_mipmap_location { my ($r, $id, $width, $height) = @_; - my $dir = POSIX::floor($id / 256); + my $dir = POSIX::floor($id / 256); return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-mipmap-$width-$height.jpg"; } @@ -581,7 +581,7 @@ sub ensure_cached { return ($fname, undef); } - my $cachename = get_cache_location($r, $id, $xres, $yres); + my $cachename = get_cache_location($id, $xres, $yres); my $err; if (! -r $cachename or (-M $cachename > -M $fname)) { # If we are in overload mode (aka Slashdot mode), refuse to generate @@ -596,7 +596,7 @@ sub ensure_cached { while (defined($xres) && defined($yres)) { my ($nxres, $nyres) = (shift @otherres, shift @otherres); - my $cachename = get_cache_location($r, $id, $xres, $yres); + my $cachename = get_cache_location($id, $xres, $yres); my $cimg; if (defined($nxres) && defined($nyres)) { @@ -616,7 +616,7 @@ sub ensure_cached { my $sf = "1x1"; if ($xres != -1) { - $cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter, 'sampling-factor'=>$sf); + $cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter); } # Strip EXIF tags etc. @@ -670,7 +670,7 @@ sub ensure_infobox_cached { my ($new_dbwidth, $new_dbheight); my $fname = get_disk_location($r, $id); - my $cachename = get_infobox_cache_location($r, $id, $xres, $yres, $dpr); + my $cachename = get_infobox_cache_location($id, $xres, $yres, $dpr); my $err; if (! -r $cachename or (-M $cachename > -M $fname)) { # If we are in overload mode (aka Slashdot mode), refuse to generate @@ -817,13 +817,13 @@ sub make_infobox { $model =~ s/^\s+//; $model =~ s/\s+$//; - push @parts, [ ' - ', 0 ] if (scalar @parts > 0); + push @parts, [ "\x{00A0}\x{2013}\x{00A0}", 0 ] if (scalar @parts > 0); push @parts, [ $model, 0 ]; } # classic fields if (scalar @classic_fields > 0) { - push @parts, [ ' - ', 0 ] if (scalar @parts > 0); + push @parts, [ "\x{00A0}\x{2013}\x{00A0}", 0 ] if (scalar @parts > 0); my $first_elem = 1; for my $field (@classic_fields) { @@ -838,14 +838,14 @@ sub make_infobox { $info->{'Flash'} =~ /no flash/i || $info->{'Flash'} =~ /not fired/i || $info->{'Flash'} =~ /Off/) { - push @parts, [ ' - ', 0 ] if (scalar @parts > 0); + push @parts, [ "\x{00A0}\x{2013}\x{00A0}", 0 ] if (scalar @parts > 0); push @parts, [ "No flash", 0 ]; } elsif ($info->{'Flash'} =~ /fired/i || $info->{'Flash'} =~ /On/) { - push @parts, [ ' - ', 0 ] if (scalar @parts > 0); + push @parts, [ "\x{00A0}\x{2013}\x{00A0}", 0 ] if (scalar @parts > 0); push @parts, [ "Flash", 0 ]; } else { - push @parts, [ ' - ', 0 ] if (scalar @parts > 0); + push @parts, [ "\x{00A0}\x{2013}\x{00A0}", 0 ] if (scalar @parts > 0); push @parts, [ $info->{'Flash'}, 0 ]; } }