Changeset 2635

Show
Ignore:
Timestamp:
06/24/08 05:53:50 (5 months ago)
Author:
auno
Message:

Thumbnail or pop-up files are automatically-generated use asset_c directory. BugzID:80200

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-40/lib/MT/Asset/Image.pm

    r2561 r2635  
    451451 
    452452    require MT::Util; 
    453     my $extra_path = undef; 
    454     my $extra_url = ''; 
    455     if (defined $param->{middle_path} || defined $param->{extra_path}) { 
    456         my $middle_path = $param->{middle_path} || ''; 
    457         my @split_path = split( '/', $middle_path ); 
    458         $extra_path = ''; 
    459  
    460         for my $middle (@split_path) { 
    461             $extra_path = File::Spec->catfile( $extra_path, $middle ); 
    462         } 
    463         $extra_path = File::Spec->catfile( $extra_path, $param->{extra_path} ) if ($param->{extra_path}); 
    464         $extra_url = MT::Util::caturl($middle_path, ($param->{extra_path} || '')); 
    465     } 
    466  
    467453    # Thumbnail creation 
    468454    if ( $thumb = $param->{thumb} ) { 
     
    471457        my ( $w, $h ) = map $param->{$_}, qw( thumb_width thumb_height ); 
    472458        my ($pseudo_thumbnail_url) = 
    473           $asset->thumbnail_url( Height => $h, Width => $w, Path => $extra_path, Pseudo => 1 ); 
     459          $asset->thumbnail_url( Height => $h, Width => $w, Pseudo => 1 ); 
    474460        my $thumbnail = $asset->thumbnail_filename( Height => $h, Width => $w ); 
    475         my $pseudo_thumbnail_path = File::Spec->catfile($asset->_make_cache_path($extra_path, 1), $thumbnail); 
     461        my $pseudo_thumbnail_path = File::Spec->catfile( $asset->_make_cache_path( undef, 1 ), $thumbnail ); 
    476462        my ( $base, $path, $ext ) = 
    477463          File::Basename::fileparse( $thumbnail, qr/[A-Za-z0-9]+$/ ); 
     
    576562            my $popup = $tmpl->build($ctx) or die $tmpl->errstr; 
    577563            my $fmgr = $blog->file_mgr; 
    578             my $root_path = 
    579               $param->{site_path} ? $blog->site_path : $blog->archive_path; 
    580             my $pseudo_path = $param->{site_path} ? '%r' : '%a'; 
    581             $root_path = 
    582               File::Spec->catfile( $root_path, ($extra_path || '') ); 
    583             $pseudo_path = File::Spec->catfile( $pseudo_path, ($extra_path || '') ); 
     564            my $root_path = $asset->_make_cache_path; 
     565            my $pseudo_path = $asset->_make_cache_path( undef, 1 ); 
    584566            my $abs_file_path = 
    585567              File::Spec->catfile( $root_path, $rel_path . $ext ); 
     
    597579            my ( $vol, $dirs, $basename ) = 
    598580              File::Spec->splitpath($rel_path_ext); 
    599             my $rel_url_ext = 
    600               File::Spec->catpath( $vol, $dirs, 
    601                 MT::Util::encode_url($basename) ); 
    602581 
    603582            ## Untaint. We have checked for security holes above, so we 
     
    611590                ) 
    612591              ); 
    613             $url = $param->{site_path} ? '%r' : '%a'; 
    614             $rel_url_ext =~ s!^/!!; 
    615             $url = MT::Util::caturl($url, $extra_url, $rel_url_ext); 
    616592 
    617593            my $html_pkg   = MT::Asset->handler_for_file($abs_file_path); 
     
    624600                $original   = $asset_html->clone; 
    625601                $asset_html->blog_id($blog_id); 
    626                 $asset_html->url($url); 
     602                $asset_html->url($pseudo_path); 
    627603                $asset_html->label($app->translate("Popup Page for [_1]", $asset->label || $asset->file_name)); 
    628604                $asset_html->file_path($pseudo_path);