X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=1f1eac878537ebaffcfdb4e0c54187d0bfdf1841;hp=2ca54cfa7dedcc19a2b65b15baf37c9689599c57;hb=aebd301b01c9b4e75e382fb7c1fcb9347c48ffd0;hpb=5fa6b177211912e7f02e973a1043b519b5001cff diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index 2ca54cf..1f1eac8 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -23,6 +23,7 @@ use MIME::Types; use LWP::Simple; # use Image::Info; use Image::ExifTool; +use HTML::Entities; BEGIN { use Exporter (); @@ -33,7 +34,7 @@ BEGIN { require Sesse::pr0n::Config_local; }; - $VERSION = "v2.12"; + $VERSION = "v2.21"; @ISA = qw(Exporter); @EXPORT = qw(&error &dberror); %EXPORT_TAGS = qw(); @@ -362,7 +363,12 @@ sub ensure_cached { # Strip EXIF tags etc. $cimg->Strip(); - $err = $cimg->write(filename=>$cachename, quality=>$quality); + if (($nwidth >= 640 && $nheight >= 480) || + ($nwidth >= 480 && $nheight >= 640)) { + $err = $cimg->write(filename=>$cachename, quality=>$quality, interlace=>'Plane'); + } else { + $err = $cimg->write(filename=>$cachename, quality=>$quality); + } undef $cimg; @@ -554,6 +560,20 @@ sub add_new_event { return (); } +sub guess_charset { + my $text = shift; + my $decoded; + + eval { + $decoded = Encode::decode("utf-8", $text, Encode::FB_CROAK); + }; + if ($@) { + $decoded = Encode::decode("iso8859-1", $text); + } + + return $decoded; +} + 1;