Index: imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.68
diff -u -p -r1.68 imagecache.module
--- imagecache.module	24 Apr 2008 05:27:45 -0000	1.68
+++ imagecache.module	26 Apr 2008 18:18:37 -0000
@@ -52,26 +52,53 @@ function imagecache_perm() {
 function imagecache_menu($may_cache) {
   $items = array();
   if ($may_cache) {
-
+    $items[] = array(
+      'path' => 'admin/settings/imagecache',
+      'title' => t('Imagecache Settings'),
+      'description' => t('Change how Imagecache behave.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('imagecache_file_system_settings'),
+      'access' => user_access('administer imagecache')
+    );
+  }
+  else
+  {
     // standard imagecache callback.
     $items[] = array(
-      'path' => file_directory_path() .'/imagecache', 
+      'path' => imagecache_directory_path(),
       'callback' => 'imagecache_cache',
       'access' => true,
       'type' => MENU_CALLBACK
     );
 
-    // private downloads imagecache callback 
-    $items[] = array( 
-      'path' => 'system/files/imagecache',
+    // private downloads imagecache callback
+    $items[] = array(
+      'path' => 'system' . '/' . imagecache_directory_path(),
       'callback' => 'imagecache_cache_private',
       'access' => true,
       'type' => MENU_CALLBACK
-    );     
+    );
   }
   return $items;
 }
 
+function imagecache_file_system_settings() {
+  $form['imagecache_directory_path'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Imagecache storage path'),
+    '#default_value' => imagecache_directory_path(),
+    '#maxlength' => 255,
+    '#description' => t('A file system path where the files generated by Imagecache will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to the Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
+    '#after_build' => array('system_check_directory'),
+  );
+
+  return system_settings_form($form);
+}
+
+function imagecache_directory_path() {
+  return variable_get('imagecache_directory_path', file_directory_path() . '/imagecache');
+}
+
 /**
  * Implementation of hook_imagecache_actions.
  *
@@ -188,7 +215,7 @@ function imagecache_action_definition($a
  */
 function imagecache_create_url($presetname, $path) {
   $path = _imagecache_strip_file_directory($path);
-  return file_create_url(file_directory_path() .'/imagecache/'. $presetname .'/'. $path);
+  return file_create_url(imagecache_directory_path() . '/' . $presetname . '/'. $path);
 }
 
 /**
@@ -198,7 +225,7 @@ function imagecache_create_url($presetna
  */
 function imagecache_create_path($presetname, $path) {
   $path = _imagecache_strip_file_directory($path);
-  return file_create_path() .'/imagecache/'. $presetname .'/'. $path;
+  return imagecache_directory_path() . '/' . $presetname .'/'. $path;
 }
 
 /**
