Changeset 3082 for trunk/php/lib/MTUtil.php
- Timestamp:
- 10/03/08 01:07:01 (14 months ago)
- Files:
-
- 1 modified
-
trunk/php/lib/MTUtil.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/php/lib/MTUtil.php
r3034 r3082 1301 1301 $dest; 1302 1302 $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')) { 1304 1304 return ''; 1305 1305 } … … 1314 1314 1315 1315 # for compatibility... 1316 function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto' ) {1316 function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto', $id = 0) { 1317 1317 require_once('thumbnail_lib.php'); 1318 1318 $thumb = new Thumbnail($src); … … 1320 1320 $thumb_w = $width; 1321 1321 $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); 1323 1323 1324 1324 return array($thumb_w, $thumb_h); 1325 1325 } 1326 1326 1327 function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h %x') {1327 function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h-%i%x') { 1328 1328 # Get parameter 1329 1329 $site_path = $blog['blog_site_path']; … … 1338 1338 $ts = preg_replace('![^0-9]!', '', $asset['asset_created_on']); 1339 1339 $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; 1341 1347 $thumb_name = $cache_dir . $format; 1342 1348 1343 1349 # generate thumbnail 1344 1350 require_once('thumbnail_lib.php'); … … 1347 1353 $thumb_h = $height; 1348 1354 $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)) { 1350 1356 return ''; 1351 1357 } … … 1353 1359 # make url 1354 1360 $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; 1360 1368 1361 1369 return array($thumb_url, $thumb_w, $thumb_h, $thumb_name);
