Changeset 2635
- Timestamp:
- 06/24/08 05:53:50 (20 months ago)
- Files:
-
- 1 modified
-
branches/release-40/lib/MT/Asset/Image.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-40/lib/MT/Asset/Image.pm
r2561 r2635 451 451 452 452 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 467 453 # Thumbnail creation 468 454 if ( $thumb = $param->{thumb} ) { … … 471 457 my ( $w, $h ) = map $param->{$_}, qw( thumb_width thumb_height ); 472 458 my ($pseudo_thumbnail_url) = 473 $asset->thumbnail_url( Height => $h, Width => $w, P ath => $extra_path, Pseudo => 1 );459 $asset->thumbnail_url( Height => $h, Width => $w, Pseudo => 1 ); 474 460 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 ); 476 462 my ( $base, $path, $ext ) = 477 463 File::Basename::fileparse( $thumbnail, qr/[A-Za-z0-9]+$/ ); … … 576 562 my $popup = $tmpl->build($ctx) or die $tmpl->errstr; 577 563 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 ); 584 566 my $abs_file_path = 585 567 File::Spec->catfile( $root_path, $rel_path . $ext ); … … 597 579 my ( $vol, $dirs, $basename ) = 598 580 File::Spec->splitpath($rel_path_ext); 599 my $rel_url_ext =600 File::Spec->catpath( $vol, $dirs,601 MT::Util::encode_url($basename) );602 581 603 582 ## Untaint. We have checked for security holes above, so we … … 611 590 ) 612 591 ); 613 $url = $param->{site_path} ? '%r' : '%a';614 $rel_url_ext =~ s!^/!!;615 $url = MT::Util::caturl($url, $extra_url, $rel_url_ext);616 592 617 593 my $html_pkg = MT::Asset->handler_for_file($abs_file_path); … … 624 600 $original = $asset_html->clone; 625 601 $asset_html->blog_id($blog_id); 626 $asset_html->url($ url);602 $asset_html->url($pseudo_path); 627 603 $asset_html->label($app->translate("Popup Page for [_1]", $asset->label || $asset->file_name)); 628 604 $asset_html->file_path($pseudo_path);
