Changeset 952

Show
Ignore:
Timestamp:
12/19/06 20:54:25 (2 years ago)
Author:
gboggs
Message:

- Replaced nested, duplicate code with a single statement.
- Fixed the syntax of an errant sprintf().
BugId: 46014

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/lib/MT/Asset/Image.pm

    r940 r952  
    124124    } 
    125125 
     126    my $dimensions = sprintf('width="%s" height="%s"', ($thumb 
     127        ? ($thumb->image_width, $thumb->image_height) 
     128        : ($asset->image_width, $asset->image_height))); 
     129 
    126130    if ($param->{popup}) { 
    127         my $dimensions = ''; 
    128         if ($thumb->image_width && $thumb->image_height) { 
    129             $dimensions = sprintf('width="%s" height="%s"', 
    130                 $thumb->image_width, $thumb->image_height); 
    131         } 
    132131        my $link = $thumb 
    133132            ? sprintf('<img src="%s" %s alt="%s" />', 
     
    147146            ? 'class="display_img_' . $param->{align} . '" ' : ''; 
    148147        if ($param->{thumb}) { 
    149             my $dimensions = ''; 
    150             if ($thumb->image_width && $thumb->image_height) { 
    151                 $dimensions = sprintf('width="%s" height="%s"', 
    152                     $thumb->image_width, $thumb->image_height); 
    153             } 
    154148            $text = sprintf( 
    155149                '<a href="%s"><img alt="%s" src="%s" %s %s/></a>', 
     
    160154            ); 
    161155        } else { 
    162             my $dimensions = ''; 
    163             if ($asset->image_width && $asset->image_height) { 
    164                 $dimensions = sprintf('width="%s" height="%s"', 
    165                     $asset->image_width, $asset->image_height); 
    166             } 
    167156            $text = sprintf( 
    168157                '<img alt="%s" src="%s" %s %s/>', 
     
    173162        } 
    174163    } else { 
    175         $text = sprintf( 
    176             '<a href="%s">' . MT->translate('Download file') . '</a>', 
     164        $text = sprintf('<a href="%s">%s</a>', 
    177165            MT::Util::encode_html($asset->url), 
     166            MT->translate('Download file'), 
    178167        ); 
    179168    }