Index: image/image.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.admin.inc,v
retrieving revision 1.2
diff -u -p -r1.2 image.admin.inc
--- image/image.admin.inc	27 Dec 2008 06:58:41 -0000	1.2
+++ image/image.admin.inc	15 Jan 2009 12:44:34 -0000
@@ -24,6 +24,74 @@ function image_admin_settings() {
     '#description' => t('Subdirectory in the directory %dir where pictures will be stored. Do not include trailing slash.', array('%dir' => variable_get('file_directory_path', 'files'))),
   );
 
+  $example_tokens = array(
+    '%nodepath'     => 'safe/url/example' ,
+    '%filename'     => 'sample-filename',
+    '%filename_raw' => 'Sample filename',
+    '%label'        => 'thumb',
+    '%extension'    => 'jpg',
+    '%extension_raw'=> 'JPEG',
+    '%nid'          => 666,
+    '%uid'          => $GLOBALS['user']->uid,
+    '%date'         => date('Y-m-d'),
+    '%year'         => date('Y'),
+    '%month'        => date('m'),
+    '%day'          => date('d'),
+  );
+  $available_vocabs = taxonomy_get_vocabularies('image');
+  $vocablist = '';
+  foreach($available_vocabs as $voc) {
+    $example_tokens['%vocab-'. $voc->vid] = 'a-term';
+    $vocablist .= ' %vocab-'. $voc->vid .' = '. $voc->name .' ';
+   }
+
+  $example_path = variable_get('file_directory_path', 'files') .'/'. strtr(variable_get('image_derivatives_filename_pattern', _image_default_filename_pattern()), $example_tokens );
+
+  $form['files']['image_derivatives_filename_pattern'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Filename naming pattern'),
+    '#default_value' => variable_get('image_derivatives_filename_pattern', _image_default_filename_pattern()),
+    '#description' => t('
+      Pattern to use when saving or creating derivatives (like thumbnails) for an image.
+      Available tokens are: %tokens.<br/><pre>%example_path</pre>
+      ',
+      array(
+        '%tokens' => join(', ', array_keys($example_tokens)),
+        '%example_path' => $example_path,
+        '%vocablist' => $vocablist,
+      )
+    ),
+  );
+
+  // rename/move originals
+  $form['files']['image_move_originals'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => variable_get('image_move_originals', FALSE),
+    '#title' => t('Force renaming of original'),
+    '#description' => t('Normally previously-uploaded images remain where they were put, but if you are using the filename pattern to organise your directories, we want to move them also. Set this option, and the next time images are rebuilt, the original file will be renamed also.'),
+  );
+
+  $form['files']['image_derivatives_filename_help'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Filename pattern help'),
+    '#collapsible' => TRUE, '#collapsed' => TRUE,
+    '#description' => t('
+      <b>%filename</b> is a sanitized version of the upload name, with special characters converted to "-" and lowercased.
+      If you want to keep the messy filename, use <b>%filename_raw</b>.
+      <b>%extension</b> (eg "jpg") will be forced to lowercase unless you use <b>%extension_raw</b>.<br />
+      <b>%vocab-n</b> will be replaced with a term from the named vocabulary: %vocablist. <br />
+      Missing elements will be collapsed cleanly if possible.
+      (<b>images/%vocab-2/%filename.%label.%extension</b> will become <b>images/%filename.%extension</b> if no vocab-2 term or label is present).
+      This pattern is re-run any time "rebuild derivatives" happens to an image, so it may cause sweeping changes and file links getting lost!
+      <br/>However, to make this change take effect on existing images, you may have to visit !admin-content and choose to apply the changes to the files yourself.
+      ',
+      array(
+        '%vocablist' => $vocablist,
+        '!admin-content' => l('admin/content', 'admin/content/node')
+      )
+    ),
+  );
+
   $form['files']['image_max_upload_size'] = array(
     '#type' => 'textfield',
     '#title' => t('Maximum upload size'),
