--- imagefield.module	2008-05-13 10:09:22.000000000 +1000
+++ imagefield.fix.module	2008-05-13 10:09:14.000000000 +1000
@@ -73,7 +73,7 @@ function imagefield_theme() {
  */
 function imagefield_elements() {
   $elements = array();
-  $elements['imagefield_widget_default'] =  array(
+  $elements['image'] =  array(
     '#input' => TRUE,
     '#columns' => array('fid', 'title', 'alt'),
     '#process' => array('imagefield_element_process'),
@@ -98,6 +98,14 @@ function imagefield_element_process($ele
     // Unset the storage to keep the form from unnecessarily rebuilding.
     unset($form_state['storage'][$fieldname]);
   }
+  // Change the type and theme to prevent FAPI from trying to output with the
+  // theme_image() function.
+  $element['#type'] = 'imagefield';
+  $element['#theme'] = 'imagefield';
+  $element['#tree'] = TRUE;
+  $element['#description'] = t('Changes made to the attachments are not permanent until you save this post.');
+
+
   // Set an internal flag for requiredness. Prevents FAPI from interfering.
   $element['#image_required'] = $element['#required'];
   $element['#required'] = FALSE;
@@ -498,7 +506,7 @@ function imagefield_file($op, $file) {
  */
 function imagefield_widget_info() {
   return array(
-    'imagefield_widget_default' => array(
+    'image' => array(
       'label' => t('Image'),
       'field types' => array('image'),
       'multiple values' => CONTENT_HANDLE_MODULE,
@@ -734,7 +742,7 @@ function theme_imagefield_row($element) 
 /**
  * FormAPI theme function. Theme the output of an image field.
  */
-function theme_imagefield_widget_default(&$element) {
+function theme_imagefield(&$element) {
   $output = '';
 
   // Always add tabledrag in case a table is created after uploads.
@@ -869,7 +877,7 @@ if (!function_exists('upload_file_downlo
  * Menu-callback for JavaScript-based uploads.
  */
 function imagefield_js($node_type, $fieldname) {
-  $field = content_fields($fieldname, $node_typ);
+  $field = content_fields($fieldname, $node_type);
 
   $form_state = array('values' => $_POST);
   $form_state['values'][$fieldname] = isset($form_state['values'][$fieldname]) ? $form_state['values'][$fieldname] : array();
