Changeset 969

Show
Ignore:
Timestamp:
12/21/06 01:47:02 (2 years ago)
Author:
bchoate
Message:

Fixed filename in url for assets of overwritten files.

Files:

Legend:

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

    r968 r969  
    281281    if (my $blog = $asset->blog) { 
    282282        require File::Basename; 
    283         if(my $thumbnail_file = $asset->thumbnail_file(@_)) { 
     283        if (my $thumbnail_file = $asset->thumbnail_file(@_)) { 
    284284            my $file = File::Basename::basename($thumbnail_file); 
    285285            my $site_url = $blog->site_url; 
  • branches/wheeljack/lib/MT/Asset/Image.pm

    r966 r969  
    150150 
    151151    if ($param->{popup}) { 
     152        my $popup = MT::Asset->load($param->{popup_asset_id}) || 
     153            return $asset->error( 
     154                MT->translate("Can't load asset #[_1]", 
     155                    $param->{popup_asset_id}) 
     156            ); 
    152157        my $link = $thumb 
    153158            ? sprintf('<img src="%s" %s alt="%s" />', 
     
    159164        $text = sprintf( 
    160165            q|<a href="%s" onclick="window.open('%s','popup','width=%d,height=%d,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">%s</a>|, 
    161             MT::Util::encode_html($asset->url), 
    162             MT::Util::encode_html($asset->url), 
     166            MT::Util::encode_html($popup->url), 
     167            MT::Util::encode_html($popup->url), 
    163168            $asset->image_width, $asset->image_height, $link, 
    164169        ); 
     
    295300        my $i = 0; 
    296301        while ($fmgr->exists($t_file)) { 
    297             $t_file = File::Spec->catfile($path . $base . '-thumb' . (++$i) . $ext); 
     302            $basename = $base . '-thumb' . (++$i) . $ext; 
     303            $t_file = File::Spec->catfile($path . $basename); 
    298304        } 
    299305        $fmgr->put_data($blob, $t_file, 'upload') 
     
    305311        $url .= '/' unless $url =~ m!/$!; 
    306312        $url .= $file; 
    307         $thumb = $url . MT::Util::encode_url($base . '-thumb' . $ext); 
     313        $thumb = $url . MT::Util::encode_url($basename); 
    308314 
    309315        my $img_pkg = MT::Asset->handler_for_file($t_file); 
     
    401407            $asset_html->parent($asset->id); 
    402408            $asset_html->save; 
     409 
     410            $param->{popup_asset_id} = $asset_html->id; 
     411 
    403412            MT->run_callbacks('CMSPostSave.asset', $app, $asset_html, $original); 
    404413