diff U3Bi E:/Downloads/Drupal/!patches/node_images/node_images.module.original E:/Downloads/Drupal/!patches/node_images/node_images.module
--- E:/Downloads/Drupal/!patches/node_images/node_images.module.original	Sun Oct 07 20:12:24 2007
+++ E:/Downloads/Drupal/!patches/node_images/node_images.module	Wed Oct 31 00:52:07 2007
@@ -309,7 +309,7 @@
 
 function _node_images_edit_form_upload($node) {
   $path = file_directory_path().'/'.variable_get('node_images_path', 'node_images');
-  _node_images_check_directory(NULL, $path);
+  _node_images_check_directory(NULL, $path, $node);
   $extensions = variable_get('node_images_extensions', 'jpg jpeg gif png');
 
   drupal_add_js('misc/progress.js');
@@ -538,7 +538,7 @@
     if (!isset($node->files[$fid])) return FALSE;
 
     // Normalize filename and check description
-    $dest = _node_images_get_directory();
+    $dest = _node_images_get_directory($node);
     if (trim($edit['description']) == '') {
       $edit['description'] = basename($file->filename);
     }
@@ -739,7 +739,7 @@
     '#title' => t('Node images path'),
     '#default_value' => variable_get('node_images_path', 'node_images'),
     '#maxlength' => 255,
-    '#description' => t('Subdirectory in the directory %dir where the node images will be stored. This directory has to exist and be writable by Drupal. You can use the following variables: %uid, %username', array('%dir' => file_directory_path() .'/')),
+    '#description' => t('Subdirectory in the directory %dir where the node images will be stored. This directory has to exist and be writable by Drupal. You can use the following variables: %uid, %username, %nid, %nodetype', array('%dir' => file_directory_path() .'/')),
     '#after_build' => array('_node_images_check_directory'),
   );
   $form['node_images_large_resolution'] = array(
@@ -814,9 +814,9 @@
  * @param $form_element
  *   The form element containing the name of the directory to check.
  */
- function _node_images_check_directory($form_element = NULL, $path = '') {
+ function _node_images_check_directory($form_element = NULL, $path = '', $node) {
   global $user;
-  $variables = array('%uid' => $user->uid, '%username' => $user->name);
+  $variables = array('%uid' => $user->uid, '%username' => $user->name, '%nid' => $node->nid, '%nodetype' => $node->type);
   if ($form_element) {
     $path = file_directory_path().'/'.strtr($form_element['#value'], $variables);
     _node_images_mkdir_recursive($path, FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
@@ -841,10 +841,10 @@
 /**
  * Return the destination directory.
  */
-function _node_images_get_directory() {
+function _node_images_get_directory($node) {
   global $user;
   $path = file_directory_path().'/'.variable_get('node_images_path', 'node_images');
-  return strtr($path, array('%uid' => $user->uid, '%username' => $user->name));
+  return strtr($path, array('%uid' => $user->uid, '%username' => $user->name, '%nid' => $node->nid, '%nodetype' => $node->type));
 }
 
 /**
