--- imagefield.module.old	2008-05-13 02:02:02.000000000 +0200
+++ imagefield.module	2008-07-02 10:50:00.000000000 +0200
@@ -464,14 +464,40 @@ function imagefield_widget_settings($op,
         '#type' => 'checkbox',
         '#title' => t('Enable custom alternate text'),
         '#default_value' =>  $widget['custom_alt'] ? $widget['custom_alt'] : 0,
-        '#description' => t('Enable custom alternate text for images. Filename will be used if not checked.'),
+        '#description' => t('Enable custom alternate text for images. Default will be used if not checked.'),
       );
       $form['custom_title'] = array(
         '#type' => 'checkbox',
         '#title' => t('Enable custom title text'),
         '#default_value' =>  $widget['custom_title'] ? $widget['custom_title'] : 0,
-        '#description' => t('Enable custom title text for images. Filename will be used if not checked.'),
+        '#description' => t('Enable custom title text for images. Default will be used if not checked.'),
       );
+
+      $form['default_alt'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Default alternate text for images'),
+        '#default_value' => $widget['default_alt'] ? $widget['default_alt'] : '',
+        '#size' => 80,
+        '#maxlength' => 80,
+        '#description' => t('You can set a default alternate text.'),
+      );
+      if (function_exists('token_replace')) {
+        $form['default_title']['#description'] .= ' '. t('You can use the following tokens in the default alt text.');
+        $form['default_title']['#suffix'] = theme('token_help', 'node');
+      }
+      $form['default_title'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Default title text for images'),
+        '#default_value' => $widget['default_title'] ? $widget['default_title'] : '',
+        '#size' => 80,
+        '#maxlength' => 80,
+        '#description' => t('You can set a default title text.'),
+      );
+      if (function_exists('token_replace')) {
+        $form['default_title']['#description'] .= ' '. t('You can use the following tokens in the default title text.');
+        $form['default_title']['#suffix'] = theme('token_help', 'node');
+      }
+
       return $form;
 
     case 'validate':
@@ -481,7 +507,7 @@ function imagefield_widget_settings($op,
       break;
 
     case 'save':
-      return array('max_resolution', 'max_filesize', 'max_number_images', 'image_path', 'file_extensions', 'custom_alt', 'custom_title');
+      return array('max_resolution', 'max_filesize', 'max_number_images', 'image_path', 'file_extensions', 'custom_alt', 'custom_title', 'default_alt', 'default_title');
   }
 }
 
@@ -761,14 +787,17 @@ function _imagefield_widget_form($node, 
 
         $form[$fieldname][$delta]['alt'] = array(
           '#type' => 'hidden',
-          '#value' => $file['filename'],
+          '#value' => $field['widget']['default_alt'],
         );
+        if (function_exists('token_replace')) {
+          $form[$fieldname][$delta]['alt']['#value'] = token_replace($field['widget']['default_alt'], 'node', $node);
+        }
+        
         // overwrite with an input field if custom_alt is flagged;
         if ($field['widget']['custom_alt']) {
           $form[$fieldname][$delta]['alt'] = array(
             '#type' => 'textfield',
             '#title' =>  t('Alternate text'),
-            '#default_value' => $file['alt'],
             '#description' => t('Alternate text to be displayed if the image cannot be displayed.'),
             '#maxlength' => 255,
             '#size' => 10,
@@ -777,14 +806,18 @@ function _imagefield_widget_form($node, 
 
         $form[$fieldname][$delta]['title'] = array(
           '#type' => 'hidden',
-          '#value' => $file['filename'],
+          '#value' => $field['widget']['default_title'],
         );
+        if (function_exists('token_replace')) {
+          $form[$fieldname][$delta]['title']['#value'] = token_replace($field['widget']['default_title'], 'node', $node);
+        }
+
+
         // overwrite with an input field if custom_title is flagged;
         if ($field['widget']['custom_title']) {
           $form[$fieldname][$delta]['title'] = array(
             '#type' => 'textfield',
             '#title' =>  t('Title'),
-            '#default_value' =>  $file['title'],
             '#description' => t('Text to be displayed on mouse overs.'),
             '#maxlength' => 255,
             '#size' => 10,
