--- imagefield_widget.inc	2009-03-28 04:10:11.000000000 +0100
+++ imagefield_widget.inc.new	2009-04-04 02:06:40.000000000 +0200
@@ -5,7 +5,7 @@
  * @file
  * ImageField widget hooks and callbacks.
  *
- * This file is loaded by fileifeld.module and the callbacks it contains are
+ * This file is loaded by filefield.module and the callbacks it contains are
  * invoked by filefield.module. This happens because imagefield delegates it's
  * CCK hooks and callbacks to filefield in imagefield.module.
  */
@@ -92,6 +92,15 @@ function imagefield_widget_settings_form
     '#description' => t('This value will be used as the image title by default.'),
     '#suffix' =>  theme('token_help', 'file'),
   );
+  $form['title_settings']['title_type'] = array(
+    '#type' => 'select',
+    '#title' => t('Input type'),
+    '#options' => array(
+      'textfield' => 'textfield',
+      'textarea' => 'textarea'),
+    '#default_value' => !empty($widget['title_type']) ? $widget['title_type'] : 'textfield',
+    '#description' => t('Choose textfield or textarea for the input type of the image title. Warning : if you are using a WYSIWYG editor, choosing textarea here should introduce HTML markup in the image title, so prefer textfield if you can not deal with that.'),
+  );
 
   // Default image settings.
   $form['default'] = array(
@@ -187,6 +196,7 @@ function imagefield_widget_settings_vali
       form_set_error($resolution, t('Please specify a resolution in the format WIDTHxHEIGHT (e.g. 640x480).'));
     }
   }
+
 }
 
 /**
@@ -195,7 +205,7 @@ function imagefield_widget_settings_vali
 function imagefield_widget_settings_save($widget) {
   // TODO: Rename custom_alt and custom_title to alt_custom and title_custom.
   $filefield_settings = module_invoke('filefield', 'widget_settings', 'save', $widget);
-  return array_merge($filefield_settings, array('max_resolution', 'min_resolution', 'alt',  'custom_alt', 'title', 'custom_title', 'default_image', 'use_default_image'));
+  return array_merge($filefield_settings, array('max_resolution', 'min_resolution', 'alt',  'custom_alt', 'title', 'custom_title', 'title_type', 'default_image', 'use_default_image'));
 }
 
 /**
@@ -237,7 +247,7 @@ function imagefield_widget_process($elem
     '#type' => $field['widget']['custom_alt'] ? 'textfield' : 'value',
     '#default_value' => $default_alt ? $field['widget']['alt'] : $file['data']['alt'],
     '#description' => t('This text will be used by screen readers, search engines, or when the image cannot be loaded.'),
-    '#maxlength' => variable_get('imagefield_alt_length', 80), // See http://www.gawds.org/show.php?contentid=28.
+    '#maxlength' => 80, // See http://www.gawds.org/show.php?contentid=28.
     '#attributes' => array('class' => 'imagefield-text'),
   );
   // #value must be hard-coded if #type = 'value'.
@@ -251,7 +261,7 @@ function imagefield_widget_process($elem
     $field['widget']['title'] = token_replace($field['widget']['title'], 'user', $GLOBALS['user']);
   }
   $element['data']['title'] = array(
-    '#type' => $field['widget']['custom_title'] ? 'textfield' : 'value',
+    '#type' => $field['widget']['custom_title'] ? $field['widget']['title_type'] : 'value',
     '#title' => t('Title'),
     '#default_value' => $default_title ? $field['widget']['title'] : $file['data']['title'],
     '#description' => t('The title is used as a tool tip when the user hovers the mouse over the image.'),
