]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Set the default to be infobox + reencoded; add an option to always give
[pr0n] / perl / Sesse / pr0n / Common.pm
index e545e91d9e5a06704a2bc30baf949a3badaf95dd..cb02a154c90912ba5e1b7065d2641203497f5801 100644 (file)
@@ -269,7 +269,7 @@ sub ensure_cached {
        my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
 
        my $fname = get_disk_location($r, $id);
-       unless (defined($xres) && ($xres < $dbheight || $yres < $dbwidth || $dbwidth == -1 || $dbheight == -1)) {
+       unless (defined($xres) && ($xres < $dbheight || $yres < $dbwidth || $dbwidth == -1 || $dbheight == -1 || $xres == -1)) {
                return ($fname, 0);
        }
 
@@ -341,9 +341,11 @@ sub ensure_cached {
                                $quality = 80;
                        }
 
-                       $cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter);
+                       if ($xres != -1) {
+                               $cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter);
+                       }
 
-                       if (($nwidth >= 800 || $nheight >= 600) && $infobox == 1) {
+                       if (($nwidth >= 800 || $nheight >= 600 || $xres == -1) && $infobox == 1) {
                                make_infobox($cimg, $info, $r);
                        }