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

[livejournal] r16309: LJSV-336 (Error message/system text for ...

Committer: ailyin
LJSV-336 (Error message/system text for custom mood theme creator): do not add class when user has provided width/height themselves

U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/ljmood.pl
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2010-03-03 09:02:34 UTC (rev 16308)
+++ trunk/cgi-bin/LJ/S2.pm	2010-03-03 09:13:07 UTC (rev 16309)
@@ -1891,7 +1891,13 @@
             $img_alt = $mood;
             $e->{'metadata'}->{'mood'} = "$mood$extra";
         }
-        $e->{'mood_icon'} = Image($pic{'pic'}, $pic{'w'}, $pic{'h'}, $img_alt, 'class' => 'meta-mood-img' )
+        my ($width, $height, %img_extra);
+        if ($pic{'w'} && $pic{'h'}) {
+            ($width, $height) = @pic{('w', 'h')};
+        } else {
+            $img_extra{'class'} = 'meta-mood-img';
+        }
+        $e->{'mood_icon'} = Image($pic{'pic'}, $width, $height, $img_alt, %img_extra )
             if LJ::get_mood_picture($theme, $mid, \%pic);
     }
     if ($p->{'current_mood'}) {

Modified: trunk/cgi-bin/ljmood.pl
===================================================================
--- trunk/cgi-bin/ljmood.pl	2010-03-03 09:02:34 UTC (rev 16308)
+++ trunk/cgi-bin/ljmood.pl	2010-03-03 09:13:07 UTC (rev 16309)
@@ -110,9 +110,12 @@
     my %pic = @_;
 
     my @attrs;
-    push @attrs, "width='$pic{'w'}'" if $pic{'w'};
-    push @attrs, "height='$pic{'h'}'" if $pic{'h'};
-    push @attrs, 'class="meta-mood-img"';
+    if ($pic{'w'} && $pic{'h'}) {
+        push @attrs, "width='$pic{'w'}'";
+        push @attrs, "height='$pic{'h'}'";
+    } else {
+        push @attrs, 'class="meta-mood-img"';
+    }
 
     return join(' ', @attrs);
 

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