Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r23180: LJSUP-13959 (Picture in the post looks i...

Committer: ailyin
LJSUP-13959 (Picture in the post looks incorrect)
U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2012-10-22 11:59:40 UTC (rev 23179)
+++ trunk/cgi-bin/cleanhtml.pl	2012-10-22 12:08:17 UTC (rev 23180)
@@ -1130,9 +1130,19 @@
                             $img_bad = 1;
                         }
 
-                    }
-                    else {
+                    } elsif ( my $maxwidth = $opts->{'maximgwidth'} ) {
                         $img_bad = 0;
+
+                        my $width = $hash->{'width'};
+                        if ( $width && $width !~ /\%$/ ) {
+                            $width =~ s/\D//g;
+                            if ( int $width > $maxwidth ) {
+                                delete $hash->{'width'};
+                                delete $hash->{'height'};
+                            }
+                        }
+                    } else {
+                        $img_bad = 0;
                     }
 
                     ## Option 'allowed_img_attrs' provides a list of allowed attributes

Tags: ailyin, andy, livejournal, pl
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