Index: imagecache.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v retrieving revision 1.91 diff -u -r1.91 imagecache.module --- imagecache.module 29 Oct 2008 21:23:59 -0000 1.91 +++ imagecache.module 30 Oct 2008 09:31:10 -0000 @@ -485,36 +485,42 @@ return false; } - if (!$image = imageapi_image_open($src)) { - return false; + // Simply copy the file if there are no actions. + if (empty($actions)) { + return file_copy($src, $dst, FILE_EXISTS_REPLACE); } + else { + if (!$image = imageapi_image_open($src)) { + return false; + } - foreach ($actions as $action) { - if (!empty($action['data'])) { - // QuickSketch, why do these run first/twice? - dopry. - if (isset($action['data']['width'])) { - $width = _imagecache_filter('width', $action['data']['width'], $image->info['width'], $image->info['height']); - } - if (isset($action['data']['height'])) { - $height = _imagecache_filter('height', $action['data']['height'], $image->info['width'], $image->info['height']); + foreach ($actions as $action) { + if (!empty($action['data'])) { + // QuickSketch, why do these run first/twice? - dopry. + if (isset($action['data']['width'])) { + $width = _imagecache_filter('width', $action['data']['width'], $image->info['width'], $image->info['height']); + } + if (isset($action['data']['height'])) { + $height = _imagecache_filter('height', $action['data']['height'], $image->info['width'], $image->info['height']); + } + foreach ($action['data'] as $key => $value) { + $action['data'][$key] = _imagecache_filter($key, $value, $image->info['width'], $image->info['height'], $width, $height); + } } - foreach ($action['data'] as $key => $value) { - $action['data'][$key] = _imagecache_filter($key, $value, $image->info['width'], $image->info['height'], $width, $height); + if (!_imagecache_apply_action($action, $image)) { + watchdog('imagecache', 'action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src), WATCHDOG_ERROR); + return false; } } - if (!_imagecache_apply_action($action, $image)) { - watchdog('imagecache', 'action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src), WATCHDOG_ERROR); + + if (!imageapi_image_close($image, $dst)) { + if (file_exists($dst)) { + watchdog('imagecache', 'Cached image file %dst already exists. There may be an issue with your rewrite configuration.', array('%dst' => $dst), WATCHDOG_ERROR); + } return false; } } - if (!imageapi_image_close($image, $dst)) { - if (file_exists($dst)) { - watchdog('imagecache', 'Cached image file %dst already exists. There may be an issue with your rewrite configuration.', array('%dst' => $dst), WATCHDOG_ERROR); - } - return false; - } - return true; }