Show
Ignore:
Timestamp:
10/03/08 01:07:01 (14 months ago)
Author:
bchoate
Message:

Merging fireball branch changes to-date to trunk: svn merge -r2974:3081 http://code.sixapart.com/svn/movabletype/branches/fireball .

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/php/lib/MTUtil.php

    r3034 r3082  
    13011301    $dest; 
    13021302    $thumb_name = $static_file_path.DIRECTORY_SEPARATOR.$image_path.DIRECTORY_SEPARATOR.$format; 
    1303     if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name, 'png')) { 
     1303    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $asset['asset_id'], $scale, $thumb_name, 'png')) { 
    13041304        return ''; 
    13051305    } 
     
    13141314 
    13151315# for compatibility... 
    1316 function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto') { 
     1316function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto', $id = 0) { 
    13171317    require_once('thumbnail_lib.php'); 
    13181318    $thumb = new Thumbnail($src); 
     
    13201320    $thumb_w = $width; 
    13211321    $thumb_h = $height; 
    1322     $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, null, $dest_type); 
     1322    $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $id, $scale, null, $dest_type); 
    13231323 
    13241324    return array($thumb_w, $thumb_h); 
    13251325} 
    13261326 
    1327 function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h%x') { 
     1327function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h-%i%x') { 
    13281328    # Get parameter 
    13291329    $site_path = $blog['blog_site_path']; 
     
    13381338    $ts = preg_replace('![^0-9]!', '', $asset['asset_created_on']); 
    13391339    $date_stamp = format_ts('%Y/%m', $ts, $blog); 
    1340     $cache_dir = $site_path . DIRECTORY_SEPARATOR . $cache_path . DIRECTORY_SEPARATOR . $date_stamp . DIRECTORY_SEPARATOR; 
     1340    $base_path = $site_path; 
     1341    if (preg_match('/^%a/', $asset['asset_file_path']) && !empty($blog['blog_archive_path'])) { 
     1342        $base_path = $blog['blog_archive_path']; 
     1343        $base_path = preg_replace('/\/$/', '', $base_path); 
     1344    } 
     1345 
     1346    $cache_dir = $base_path . DIRECTORY_SEPARATOR . $cache_path . DIRECTORY_SEPARATOR . $date_stamp . DIRECTORY_SEPARATOR; 
    13411347    $thumb_name = $cache_dir . $format; 
    1342   
     1348 
    13431349    # generate thumbnail 
    13441350    require_once('thumbnail_lib.php'); 
     
    13471353    $thumb_h = $height; 
    13481354    $dest; 
    1349     if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $scale, $thumb_name)) { 
     1355    if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $asset['asset_id'], $scale, $thumb_name)) { 
    13501356        return ''; 
    13511357    } 
     
    13531359    # make url 
    13541360    $basename = basename($dest); 
    1355     $site_url = $blog['blog_site_url']; 
    1356     if (!preg_match('!/$!', $site_url)) 
    1357         $site_url .= '/'; 
    1358  
    1359     $thumb_url = $site_url . $cache_path . '/' . $date_stamp . '/' . $basename; 
     1361    $base_url = $blog['blog_site_url']; 
     1362    if (preg_match('/^%a/', $asset['asset_file_path']) && !empty($blog['blog_archive_url'])) 
     1363        $base_url = $blog['blog_archive_url']; 
     1364    if (!preg_match('!/$!', $base_url)) 
     1365        $base_url .= '/'; 
     1366 
     1367    $thumb_url = $base_url . $cache_path . '/' . $date_stamp . '/' . $basename; 
    13601368 
    13611369    return array($thumb_url, $thumb_w, $thumb_h, $thumb_name);