Index: imagecache.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v retrieving revision 1.19.2.36 diff -u -p -u -p -r1.19.2.36 imagecache.module --- imagecache.module 31 Mar 2008 21:01:23 -0000 1.19.2.36 +++ imagecache.module 5 Apr 2008 07:07:48 -0000 @@ -165,9 +165,13 @@ function imagecache_cache() { $actions = _imagecache_actions_get_by_presetid($preset_id); foreach ($actions as $action) { - $size = getimagesize($tmpdestination); - if (empty($action['data']['height'])) $action['data']['height'] = round($size[1] * ($action['data']['width'] / $size[0])); - if (empty($action['data']['width'])) $action['data']['width'] = $size[0] * ($action['data']['height'] / $size[1]); + $size = getimagesize($tmp); + if (empty($action['data']['height'])) { + $action['data']['height'] = round($size[1] * ($action['data']['width'] / $size[0])); + } + if (empty($action['data']['width'])) { + $action['data']['width'] = $size[0] * ($action['data']['height'] / $size[1]); + } $new_width = _imagecache_filter('width', $action['data']['width'], $size[0], $size[1]); $new_height = _imagecache_filter('height', $action['data']['height'], $size[0], $size[1]); @@ -198,15 +202,16 @@ function imagecache_cache() { } // move the temporary file to it's final destination. - if (!file_move($tmp, file_create_path($dst))) { + $final_path = file_create_path($dst); + if (!file_move($tmp, $final_path)) { watchdog('imagecache', t('Could not move tmp(%t) to dst(%d).', array('%d' => $dst, '%t' => $tmp)), WATCHDOG_ERROR); header("HTTP/1.0 500 Internal Server Error"); exit; } // Serve it up... - $size = getimagesize($dst); - file_transfer($dst, array('Content-Type: '. mime_header_encode($size['mime']), 'Content-Length: '. filesize($dst))); + $size = getimagesize($final_path); + file_transfer($final_path, array('Content-Type: '. mime_header_encode($size['mime']), 'Content-Length: '. filesize($final_path))); exit; }