Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r21433: LJSUP-11548: Bad working placeholders

Committer: amyshkin
LJSUP-11548: Bad working placeholders
U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2012-03-16 09:06:13 UTC (rev 21432)
+++ trunk/cgi-bin/cleanhtml.pl	2012-03-16 11:30:45 UTC (rev 21433)
@@ -115,8 +115,7 @@
 # des-opts: An hash of options to pass to the parser.
 # returns: Nothing.
 # </LJFUNC>
-sub clean
-{
+sub clean {
     my $data = shift;
     my $opts = shift;
     my $newdata;
@@ -1152,11 +1151,8 @@
                     if ($opts->{'extractimages'}) { $img_bad = 1; }
 
                     # don't use placeholders for small images
-                    if ($opts->{'img_placeholders'}) {
-                        if ( !defined $hash->{width} || ! defined $hash->{height} ) {
-                            $img_bad = 1;
-                        }
-                        else {
+                    if ( $opts->{'img_placeholders'} ) {
+                        if ( exists $hash->{width} && $hash->{width} && exists $hash->{height} && $hash->{height} ) {
                             if ( $hash->{'width'} > 140 && $hash->{'height'} > 37 ) {
                                 $img_bad = 1;
                             }
@@ -1164,6 +1160,10 @@
                                 $img_bad = 0;
                             }
                         }
+                        else {
+                            $img_bad = 1;
+                        }
+
                     }
                     else {
                         $img_bad = 0;

Tags: amyshkin, livejournal, pl, zilogic
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments