Index: cloudfront.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cloudfront/cloudfront.module,v
retrieving revision 1.2
diff -u -p -s -r1.2 cloudfront.module
--- cloudfront.module	31 Mar 2009 10:20:00 -0000	1.2
+++ cloudfront.module	7 Jun 2009 17:40:53 -0000
@@ -35,7 +35,11 @@ function cloudfront_create_url($imagecac
   // If the imagecache preset is modified or flushed then the file will be missing.
   // By returning false we give imagecache a chance to regenerate this image and
   // send the new version to s3.
-  $imagecache_path = file_directory_path() .'/imagecache/'. $imagecache_namespace .'/'. basename($path);
+  if (!module_exists('imagecache')) {
+		module_invoke('imagecache');
+  }
+  $imagecache_path = imagecache_create_path($preset_info['presetname'],$path);
+
   if (!file_exists($imagecache_path)) {
     return false;
   }
