Changeset 1026
- Timestamp:
- 01/12/07 07:33:58 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/wheeljack/php/lib/MTUtil.php
r1023 r1026 1186 1186 } 1187 1187 1188 function get_thumbnail_file($prefix, $filename, $ width = 0, $height = 0, $scale = 0) {1188 function get_thumbnail_file($prefix, $filename, $site_path, $width = 0, $height = 0, $scale = 0) { 1189 1189 # Get source image information 1190 1190 list($src_w, $src_h, $src_type, $src_attr) = getimagesize($filename); … … 1238 1238 1239 1239 # Retrieve thumbnail 1240 global $mt; 1240 1241 $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']; 1244 1244 1245 1245 if(!file_exists($thumb_name)) { branches/wheeljack/php/lib/function.MTAssetThumbnailLink.php
r1023 r1026 4 4 if (!$asset) return ''; 5 5 if ($asset['asset_class'] != 'image') return ''; 6 $blog = $ctx->stash('blog'); 7 if (!$blog) return ''; 6 8 7 9 require_once('MTUtil.php'); … … 18 20 $scale = $args['scale']; 19 21 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); 21 23 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; 24 28 } 25 29 branches/wheeljack/php/lib/function.MTAssetThumbnailURL.php
r1023 r1026 4 4 if (!$asset) return ''; 5 5 if ($asset['asset_class'] != 'image') return ''; 6 $blog = $ctx->stash('blog'); 7 if (!$blog) return ''; 6 8 7 9 require_once('MTUtil.php'); … … 18 20 $scale = $args['scale']; 19 21 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); 21 23 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; 24 28 } 25 29
