--- imagefield.module	2008-05-13 12:02:02.000000000 +1200
+++ imagefield.patched.module	2008-06-06 13:35:05.000000000 +1200
@@ -243,7 +243,14 @@ function imagefield_file_insert($node, &
   // allow tokenized paths.
   if (function_exists('token_replace')) {
     global $user;
-    $widget_image_path = token_replace($field['widget']['image_path'], 'user', $user);
+    //set node created and changed, if not set, for date style tokens to work
+    if(!$node->created){
+      $node->created = time();
+    }
+    if(!$node->changed){
+      $node->changed = time();
+    }    
+    $widget_image_path = token_replace($field['widget']['image_path'], 'node', $node);
   }
   else {
     $widget_image_path = $field['widget']['image_path'];
@@ -449,7 +456,7 @@ function imagefield_widget_settings($op,
       );
       if (function_exists('token_replace')) {
         $form['image_path']['#description'] .= ' '. t('You can use the following tokens in the image path.');
-        $form['image_path']['#suffix'] = theme('token_help', 'user');
+        $form['image_path']['#suffix'] = theme('token_help', 'node');
       }
       $form['file_extensions'] = array(
         '#type' => 'textfield',
@@ -605,7 +612,14 @@ function _imagefield_widget_prepare_form
       // Allow tokenized paths if available
       if (function_exists('token_replace')) {
         global $user;
-        $widget_image_path = token_replace($field['widget']['image_path'], 'user', $user);
+        //set node created and changed, if not set, for date style tokens to work
+        if(!$node->created){
+          $node->created = time();
+        }
+        if(!$node->changed){
+          $node->changed = time();
+        } 
+        $widget_image_path = token_replace($field['widget']['image_path'], 'node', $node);
       }
       else {
         $widget_image_path = $field['widget']['image_path'];
@@ -743,7 +757,14 @@ function _imagefield_widget_form($node, 
 
         if (function_exists('token_replace')) {
           global $user;
-          $filename = $file['fid'] == 'upload' ? file_create_filename($file['filename'], file_create_path(token_replace($field['widget']['image_path'], 'user', $user))) : $file['filepath'];
+          //set node created and changed, if not set, for date style tokens to work
+          if(!$node->created){
+            $node->created = time();
+          }
+          if(!$node->changed){
+            $node->changed = time();
+          } 
+          $filename = $file['fid'] == 'upload' ? file_create_filename($file['filename'], file_create_path(token_replace($field['widget']['image_path'], 'node', $node))) : $file['filepath'];
         }
         else {
           $filename = $file['fid'] == 'upload' ? file_create_filename($file['filename'], file_create_path($field['widget']['image_path'])) : $file['filepath'];
