]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Escape titles and dates on their way out of the HTML. It _shouldn't_ be
[pr0n] / perl / Sesse / pr0n / Common.pm
index 2ca54cfa7dedcc19a2b65b15baf37c9689599c57..1f1eac878537ebaffcfdb4e0c54187d0bfdf1841 100644 (file)
@@ -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;