Changeset 1026

Show
Ignore:
Timestamp:
01/12/07 07:33:58 (2 years ago)
Author:
takayama
Message:

Fixed BugId:46492

* Adds support of AssetCacheDir configuration

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/php/lib/MTUtil.php

    r1023 r1026  
    11861186} 
    11871187 
    1188 function get_thumbnail_file($prefix, $filename, $width = 0, $height = 0, $scale = 0) { 
     1188function get_thumbnail_file($prefix, $filename, $site_path, $width = 0, $height = 0, $scale = 0) { 
    11891189    # Get source image information 
    11901190    list($src_w, $src_h, $src_type, $src_attr) = getimagesize($filename); 
     
    12381238 
    12391239    # Retrieve thumbnail 
     1240    global $mt; 
    12401241    $path_parts = pathinfo($filename); 
    1241     $dirname = $path_parts['dirname']; 
    1242     list($basename) = split("\.", $path_parts['basename']); 
    1243     $thumb_name = $dirname . "/" . $prefix . "." . $hash . "." . $path_parts['extension']; 
     1242    $cache_path = $mt->config['AssetCacheDir']; 
     1243    $thumb_name = $site_path . "/" . $cache_path . '/' . $prefix . "." . $hash . "." . $path_parts['extension']; 
    12441244 
    12451245    if(!file_exists($thumb_name)) { 
  • branches/wheeljack/php/lib/function.MTAssetThumbnailLink.php

    r1023 r1026  
    44    if (!$asset) return ''; 
    55    if ($asset['asset_class'] != 'image') return ''; 
     6    $blog = $ctx->stash('blog'); 
     7    if (!$blog) return ''; 
    68 
    79    require_once('MTUtil.php'); 
     
    1820        $scale = $args['scale']; 
    1921 
    20     list($thumb, $thumb_w, $thumb_h) = get_thumbnail_file($asset['asset_id'], $asset['asset_file_path'], $width, $height, $scale); 
     22    list($thumb, $thumb_w, $thumb_h) = get_thumbnail_file($asset['asset_id'], $asset['asset_file_path'], $blog['blog_site_path'], $width, $height, $scale); 
    2123    if ($thumb != '') { 
    22         $thumb = basename($thumb); 
    23         $thumb = ereg_replace($asset['asset_file_name'], $thumb, $asset['asset_url']); 
     24        global $mt; 
     25        $cache_path = $mt->config['AssetCacheDir']; 
     26        $basename = basename($thumb); 
     27        $thumb = $blog['blog_site_url'] . $cache_path . '/' . $basename; 
    2428    } 
    2529 
  • branches/wheeljack/php/lib/function.MTAssetThumbnailURL.php

    r1023 r1026  
    44    if (!$asset) return ''; 
    55    if ($asset['asset_class'] != 'image') return ''; 
     6    $blog = $ctx->stash('blog'); 
     7    if (!$blog) return ''; 
    68 
    79    require_once('MTUtil.php'); 
     
    1820        $scale = $args['scale']; 
    1921 
    20     list($thumb) = get_thumbnail_file($asset['asset_id'], $asset['asset_file_path'], $width, $height, $scale); 
     22    list($thumb) = get_thumbnail_file($asset['asset_id'], $asset['asset_file_path'], $blog['blog_site_path'], $width, $height, $scale); 
    2123    if ($thumb != '') { 
    22         $thumb = basename($thumb); 
    23         $thumb = ereg_replace($asset['asset_file_name'], $thumb, $asset['asset_url']); 
     24        global $mt; 
     25        $cache_path = $mt->config['AssetCacheDir']; 
     26        $basename = basename($thumb); 
     27        $thumb = $blog['blog_site_url'] . $cache_path . '/' . $basename; 
    2428    } 
    2529