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