diff --git a/imagecache.module b/imagecache.module
index 091b0fb..b57f1cb 100644
--- a/imagecache.module
+++ b/imagecache.module
@@ -401,6 +401,10 @@ function _imagecache_strip_file_directory($path) {
 function imagecache_cache() {
   $args = func_get_args();
   $preset = check_plain(array_shift($args));
+  if ($args[0] == 'imagecache' && !variable_get('imagecache_recursive', FALSE)) {
+    header('HTTP/1.0 403 Forbidden');
+    exit;
+  }
   $path = implode('/', $args);
   _imagecache_cache($preset, $path);
 }
