diff -Nur imagecache/imagecache.module imagecache.hooked/imagecache.module
--- imagecache/imagecache.module	2009-08-19 22:59:07.000000000 +0200
+++ imagecache.hooked/imagecache.module	2010-06-04 17:41:36.074458000 +0200
@@ -380,6 +380,10 @@
   }
 }
 
+function hook_retrieve_image($path)
+{
+  return null;
+}
 /**
  * handle request validation and responses to imagecache requests.
  */
@@ -399,12 +403,28 @@
 
   // preserve path for watchdog.
   $src = $path;
-
   // Check if the path to the file exists.
   if (!is_file($src) && !is_file($src = file_create_path($src))) {
-    watchdog('imagecache', '404: Unable to find %image ', array('%image' => $src), WATCHDOG_ERROR);
-    header("HTTP/1.0 404 Not Found");
-    exit;
+    $filename = null;
+    foreach (module_implements('retrieve_image') as $module) {
+        $function_name = $module . '_retrieve_image';
+        $filename = $function_name($path);
+        if($filename != $null)
+        {
+          break;
+        }
+
+    }
+    if($filename != null)
+    {
+      $src = $filename;
+    }
+    else 
+    {
+      watchdog('imagecache', '404: Unable to find %image ', array('%image' => $src), WATCHDOG_ERROR);
+      header("HTTP/1.0 404 Not Found");
+      exit;
+    }
   };
 
   // Bail if the requested file isn't an image you can't request .php files
