--- img_assist.module	2008-05-20 14:44:17.000000000 -0400
+++ img_assist.module.orig	2008-04-21 11:48:08.000000000 -0400
@@ -350,38 +350,7 @@ function img_assist_admin_settings() {
     '#options' => array(t('Disabled'), t('Enabled')),
     '#description' => t('If enabled, the body text from the image will be loaded as the caption by default.'),
   );
-
-  // optional inclusion of non "Image" modules
-  if (module_exists('imagefield')) {
-    $form['properties']['img_assist_use_imagefield'] = array(
-      '#type' => 'radios',
-      '#title' => t('Use ImageField images'),
-      '#default_value' => variable_get('img_assist_use_imagefield', 0),
-      '#options' => array(t('Disabled'), t('Enabled')),
-      '#description' => t('If enabled, ImageField (CCK) pictures will become usable by Image Assist. Only the content type specified below will be available. Image node is still required and its permissions still determine who has access to all images.') . ' <b>' . t('Warning: ') . '</b>' . t('Multiple ImageFields in a single CCK type are not currently supported.'),
-    );
-  }
-  
-  if (module_exists('imagefield')) {
-    $form['properties']['img_assist_use_imagefield_upload_type'] = array(
-    '#type' => 'select',
-    '#title' => t('ImageField content type'),
-    '#default_value' => variable_get('img_assist_use_imagefield_upload_type', 'image'),
-    '#description' => t('The content type for Image Assist to use. Image will select the image node, which is the Image Assist default.'),
-    '#options' => array_merge(array('image' => 'Image'), _img_assist_imagefield_get_content_types()),   
-    );
-  }
   
-  if (module_exists('imagefield')) {
-    $form['properties']['img_assist_use_imagefield_description_append_field'] = array(
-    '#type' => 'select',
-    '#title' => t('Append to description'),
-    '#default_value' => variable_get('img_assist_use_imagefield_description_append_field', ''),
-    '#description' => t('This field will be appended to the image description by default. The field must be used in the content type of the ImageField in use (above).'),
-    '#options' => array_merge(array('' => 'none'), _img_assist_imagefield_get_fields()),    
-    );
-  }
-
   // Image display settings.
   $form['display'] = array(
     '#type' => 'fieldset',
@@ -464,7 +433,7 @@ function img_assist_nodeapi(&$node, $op,
       // Update the image map.
       img_assist_map_save($node);
       // Store nid globally if this node is an image uploaded with img_assist.
-      if (($node->type == 'image' || variable_get('img_assist_use_imagefield_upload_type', 'image')) && arg(0) == 'img_assist') {
+      if ($node->type == 'image' && arg(0) == 'img_assist') {
         global $_img_assist_saved_image;
         $_img_assist_saved_image = $node->nid;
       }
@@ -571,20 +540,11 @@ function img_assist_header_form($mode) {
   }
   // Browse images.
   else {
-    $type = variable_get('img_assist_use_imagefield_upload_type', 'image');
-    $field_name = _img_assist_imagefield_get_imagefield_name_by_type($type);
-    
     $form[] = array('#value' => '<div id="header-browse">');
     $form[] = array('#value' => '<strong>'. t('Browse Images: ') .'</strong>');
     
     // Get my images and count.
     $result = db_query("SELECT COUNT(n.nid) FROM {node} n WHERE n.type='image' AND n.uid= %d", $user->uid);
-    
-    if(variable_get('img_assist_use_imagefield', 0)) {
-//      $result = db_query("SELECT COUNT(n.nid) FROM {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND n.uid = %d", $user->uid);
-      $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {content_type_$type} c WHERE n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND n.uid = %d", $user->uid);
-    }
-        
     $count  = $result ? db_result($result, 0) : 0;
     $options['myimages'] = t('My Images') ." ($count)";
     
@@ -592,12 +552,6 @@ function img_assist_header_form($mode) {
     // Count all published images and the user's unpublished images.
     if (user_access('access all images')) {
       $result = db_query("SELECT COUNT(n.nid) FROM {node} n WHERE n.type='image' AND (n.uid = %d OR n.status = 1)", $user->uid);
-      
-      if(variable_get('img_assist_use_imagefield', 0) && $type != 'image') {
-//        $result = db_query("SELECT COUNT(n.nid) FROM {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND (n.uid = %d OR n.status = 1)", $user->uid);
-        $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {content_type_$type} c WHERE n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND (n.uid = %d OR n.status = 1)", $user->uid);
-      }
-      
       $count = $result ? db_result($result, 0) : 0;
       $options['allimages'] = t('All Images') ." ($count)";
     }
@@ -616,20 +570,10 @@ function img_assist_header_form($mode) {
             // unpublished images.
             if (user_access('access all images')) {
               $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {term_node} t WHERE t.nid=n.nid AND n.type='image' AND t.tid = %d AND (n.uid = %d OR n.status = 1)", $tid, $user->uid);
-              
-              if(variable_get('img_assist_use_imagefield', 0)) {
-//                $result = db_query("SELECT COUNT(n.nid) FROM {term_node} t, {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND t.tid = %d AND (n.uid = %d OR n.status = 1) AND t.nid=n.nid", $tid, $user->uid);
-                $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {content_type_$type} c, {term_node} t WHERE t.nid=n.nid AND n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND t.tid = %d AND (n.uid = %d OR n.status = 1)", $tid, $user->uid);
-              }
             }
             // For this term, count only the user's images.
             else {
               $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {term_node} t WHERE t.nid=n.nid AND n.type='image' AND t.tid = %d AND n.uid = %d", $tid, $user->uid);
-              
-              if(variable_get('img_assist_use_imagefield', 0)) {
-//                $result = db_query("SELECT COUNT(n.nid) FROM {term_node} t, {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND t.tid = %d AND n.uid = %d AND t.nid=n.nid", $tid, $user->uid);
-                $result = db_query("SELECT COUNT(n.nid) FROM {node} n, {content_type_$type} c, {term_node} t WHERE t.nid=n.nid AND n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND t.tid = %d AND n.uid = %d", $tid, $user->uid);
-              }
             }
             $count = $result ? db_result($result, 0) : 0;
             if ($count) {
@@ -650,7 +594,7 @@ function img_assist_header_form($mode) {
         '#type' => 'button',
         '#prefix' => ' '. t('or') .' ',
         '#value' => t('Upload'),
-        '#suffix' => ' '. t('a new %type', array('%type' => variable_get('img_assist_use_imagefield_upload_type', 'image'))),
+        '#suffix' => ' '. t('a new image'),
         '#button_type' => 'button',
         '#attributes' => array('onclick' => 'parent.onClickUpload()'),
       );
@@ -672,75 +616,34 @@ function img_assist_header_form($mode) {
  */
 function img_assist_upload() {
   global $user;
-  
-  $type = variable_get('img_assist_use_imagefield_upload_type', 'image');
-  if($content_type != 'image') {
-    // mbehrman 04/22/2008
-    // display the entry form for the CCK content type specified
-    // Create a node just as node.module would...
-    $types = node_get_types();
-    // If a node type has been specified, validate its existence.
-    if (isset($types[$type]) && node_access('create', $type)) {
-      // Initialize settings:
-      $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
-  
-      drupal_set_title(t('Submit @name', array('@name' => $types[$type]->name)));
-      $form = drupal_get_form($type .'_node_form', $node);
-      
-      // output a simple template containing the form
-      $output  = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
-      $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
-      $output .= "<head>\n";
-      $output .= drupal_get_html_head();
-      $output .= drupal_get_css();
-      $output .= drupal_get_js();
-      $output .= "</head>";
-      $output .= "<body>\n";
-      $output .= "<div id='img_assist_upload'>";
-      $output .= $form;
-      $output .= "</div>";
-      $output .= "</body>";
-      $output .= "</html>";
-    }
-    else {
-      if(!node_access('create', $type)) {
-        $output = t('Your account does not have privileges to create %type.', array('%type' => $type));
-      }
-      else {
-        $output = t('The node type %type does not exist.', array('%type' => $type));
-      }
-    }
-    echo $output;
+
+  if (module_exists('image') && user_access('create images')) {
+    // On other img_assist_pages I've added the javascript using the body onload
+    // attribute, but for this page will also need the collapse functions and
+    // setting the body onload interferes with this. To solve this, I'm forced
+    // use the $(document).ready call. I should probably switch all the pages to
+    // this format to be more Drupal friendly, but at the same time I don't know
+    // if it really matters. If a user doesn't have Javascript, she can't use
+    // img_assist at all.
+    $output  = "<script type=\"text/javascript\"><!-- \n";
+    $output .= "  if (Drupal.jsEnabled) { \n";
+    $output .= "    $(document).ready(parent.initUpload);\n";
+    $output .= "  } \n";
+    $output .= "--></script>\n";
+    
+    // Define an empty node and fetch an image node form
+    $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => 'image');
+    $output .= drupal_get_form('image_node_form', $node);
   }
-  else { // using the image module
-    if (module_exists('image') && user_access('create images')) {
-      // On other img_assist_pages I've added the javascript using the body onload
-      // attribute, but for this page will also need the collapse functions and
-      // setting the body onload interferes with this. To solve this, I'm forced
-      // use the $(document).ready call. I should probably switch all the pages to
-      // this format to be more Drupal friendly, but at the same time I don't know
-      // if it really matters. If a user doesn't have Javascript, she can't use
-      // img_assist at all.
-      $output  = "<script type=\"text/javascript\"><!-- \n";
-      $output .= "  if (Drupal.jsEnabled) { \n";
-      $output .= "    $(document).ready(parent.initUpload);\n";
-      $output .= "  } \n";
-      $output .= "--></script>\n";
-  
-      // Define an empty node and fetch an image node form
-      $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => 'image');
-      $output .= drupal_get_form('image_node_form', $node);
+  else {
+    if (!module_exists('image')) {
+      $output = t('The image module must be enabled to use Image assist.');
     }
     else {
-      if (!module_exists('image')) {
-        $output = t('The image module must be enabled to use Image assist.');
-      }
-      else {
-        $output = t('Your account does not have image uploading privileges.');
-      }
+      $output = t('Your account does not have image uploading privileges.');
     }
-    echo theme('img_assist_page', $output, array('id' => 'img_assist_upload', 'class' => 'img_assist'));
   }
+  echo theme('img_assist_page', $output, array('id' => 'img_assist_upload', 'class' => 'img_assist'));
 }
 
 /**
@@ -749,10 +652,7 @@ function img_assist_upload() {
  * Add a submit callback to image_node_form which alters the redirect.
  */
 function img_assist_form_alter($form_id, &$form) {
-  $type = variable_get('img_assist_use_imagefield_upload_type', 'image');
-  
-  // catch both image nodes and the specified imagefield CCK type forms
-  if (($form_id == 'image_node_form' || $type .'_node_form') && arg(0) == 'img_assist') {
+  if ($form_id == 'image_node_form' && arg(0) == 'img_assist') {
     if (!is_array($form['#submit'])) $form['#submit'] = array();
     $form['#submit'] += array('img_assist_node_form_submit' => array());
   }
@@ -773,8 +673,6 @@ function img_assist_node_form_submit($fo
  * Load the thumbnail display pane.
  *
  * Grabs all images from image.module and loads the thumbnails.
- * 
- * If ImageField exists also grabs ImageField thumbnails.
  */
 function img_assist_thumbs() {
   global $user;
@@ -795,32 +693,17 @@ function img_assist_thumbs() {
     }
     
     $output .= '<div align="center">';
-    // mbehrman 04/22/2008
-    $type = variable_get('img_assist_use_imagefield_upload_type', 'image');
-    $field_name = _img_assist_imagefield_get_imagefield_name_by_type($type);
     
     // Show by term id.
     if ($tid) {
       // For this term, show all published images and the user's unpublished images.
       if (user_access('access all images')) {
         $query = "SELECT n.nid FROM {node} n, {term_node} t WHERE t.nid=n.nid AND n.type='image' AND t.tid = %d AND (n.uid = %d OR n.status = 1) ORDER BY n.sticky DESC, n.created DESC";
-        
-        if(variable_get('img_assist_use_imagefield', 0)) {
-//          $query = "SELECT n.nid FROM {term_node} t, {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND t.tid = %d AND (n.uid = %d OR n.status = 1) AND t.nid=n.nid ORDER BY n.sticky DESC, n.created DESC";
-          $query = "SELECT n.nid FROM {node} n, {content_type_$type} c, {term_node} t WHERE t.nid=n.nid AND n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND t.tid = %d AND (n.uid = %d OR n.status = 1)  ORDER BY n.sticky DESC, n.created DESC";
-        }
-        
         $params = array($tid, $user->uid);
       }
       // For this term, show only the user's images.
       else {
         $query = "SELECT n.nid FROM {node} n, {term_node} t WHERE t.nid=n.nid AND n.type='image' AND t.tid = %d AND n.uid = %d ORDER BY n.sticky DESC, n.created DESC";
-        
-        if(variable_get('img_assist_use_imagefield', 0)) {
-//          $query = "SELECT n.nid FROM {term_node} t, {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND t.tid = %d AND n.uid = %d AND t.nid=n.nid ORDER BY n.sticky DESC, n.created DESC";
-          $query = "SELECT n.nid FROM {node} n, {content_type_$type} c, {term_node} t WHERE t.nid=n.nid AND n.nid = c.nid AND c." . $field_name . "_fid <> 0 AND t.tid = %d AND n.uid = %d ORDER BY n.sticky DESC, n.created DESC";
-        }
-        
         $params = array($tid, $user->uid);
       }
     }
@@ -828,44 +711,25 @@ function img_assist_thumbs() {
       // Show all published images and the user's unpublished images.
       if (user_access('access all images') && (!$myimagesonly)) {
         $query = "SELECT n.nid FROM {node} n WHERE n.type='image' AND (n.uid = %d OR n.status = 1) ORDER BY n.sticky DESC, n.created DESC";
-        if(variable_get('img_assist_use_imagefield', 0)) {
-          // the commented out query would display only nodes from the selected upload type... makes the counts match, but limits the images shown
-          $query = "SELECT n.nid FROM {node} n LEFT OUTER JOIN {content_type_$type} c ON n.nid = c.nid WHERE (n.type = 'image' OR c." . $field_name . "_fid <> 0) AND (n.uid = %d OR n.status = 1)  ORDER BY n.sticky DESC, n.created DESC";
-//          $query = "SELECT n.nid FROM {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND (n.uid = %d OR n.status = 1) ORDER BY n.sticky DESC, n.created DESC";
-        }
         $params = array($user->uid);
       }
       // Show only the user's images (default).
       else {
         $query = "SELECT n.nid FROM {node} n WHERE n.type='image' AND n.uid= %d ORDER BY n.sticky DESC, n.created DESC";
-        
-        if(variable_get('img_assist_use_imagefield', 0)) {
-//          $query = "SELECT n.nid FROM {node} n LEFT OUTER JOIN ({node_field_instance} LEFT OUTER JOIN ({node_field}) ON ({node_field_instance}.field_name = {node_field}.field_name)) ON {node_field_instance}.type_name = n.type WHERE ({node_field}.type = 'image' OR n.type = 'image') AND n.uid = %d ORDER BY n.sticky DESC, n.created DESC";
-          $query = "SELECT n.nid FROM {node} n LEFT OUTER JOIN {content_type_$type} c ON n.nid = c.nid WHERE (n.type = 'image' OR c." . $field_name . "_fid <> 0) AND n.uid = %d ORDER BY n.sticky DESC, n.created DESC";
-        }
-        
         $params = array($user->uid);
       }
     }
     
     $show_amount = variable_get('img_assist_preview_count', 10);
     $result = pager_query($query, $show_amount, $element = 0, $count_query = NULL, $params);
-    $no_show = 0;
     while ($row = db_fetch_object($result)) {
       $node    = node_load(array('nid' => $row->nid));
-      // warn the user if they have images hidden from node_load
-      if(variable_get('img_assist_use_imagefield', 0) && !_img_assist_imagefield_is($node) && $node->type != 'image') {
-        $no_show++;
-      }
       $image   = img_assist_display($node, IMAGE_THUMBNAIL);
       $output .= l($image, 'img_assist/properties/'. $node->nid, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = TRUE) ."\n";
     }
     if (!db_num_rows($result)) {
       $output .= t('No images were found. Please upload a new image or browse images by a different category.');
     }
-    if($no_show > 0) {
-      $output .= '<div id="img_assist_no_show">' . t('%no_show node(s) did not have images attached.', array('%no_show' => $no_show)) . '</div>';
-    }
     
     $output .= theme('pager', NULL, $show_amount);
     $output .= '</div>';
@@ -906,8 +770,7 @@ function img_assist_properties() {
  * Construct the image properties form.
  */
 function img_assist_properties_form($node, $update) {
-  $orig_path = _img_assist_imagefield_get_path($node, IMAGE_ORIGINAL);
-  $image_info = image_get_info(file_create_path($orig_path));
+  $image_info = image_get_info(file_create_path($node->images[IMAGE_ORIGINAL]));
   
   // Select (or generate) a preview image.
   $img_assist_create_derivatives = variable_get('img_assist_create_derivatives', array());
@@ -920,7 +783,6 @@ function img_assist_properties_form($nod
   else {
     $properties_size['key'] = IMAGE_THUMBNAIL;
   }
-  $properties_path = _img_assist_imagefield_get_path($node, $properties_size['key']);
   $properties_image = img_assist_display($node, $properties_size);
   // Get actual image size.
   $properties_size = image_get_info(file_create_path($node->images[$properties_size['key']]));
@@ -976,7 +838,7 @@ function img_assist_properties_form($nod
   }
   
   // Use 'preview' size by default.
-  $default_size   = image_get_info(file_create_path(_img_assist_imagefield_get_path($node, IMAGE_PREVIEW)));
+  $default_size   = image_get_info(file_create_path($node->images[IMAGE_PREVIEW]));
   $default_width  = $default_size['width'];
   $default_height = $default_size['height'];
   
@@ -1007,22 +869,12 @@ function img_assist_properties_form($nod
     '#description' => NULL,
     '#attributes' => array('onblur' => 'parent.updateCaption()'),
   );
-  
-  // mbehrman 04/23/2008 - allow CCK types to use any field
-  // and append the contents to the caption
-  $default_description = variable_get('img_assist_load_description', 1) ? $node->body : '';
-  $append_field = variable_get('img_assist_use_imagefield_description_append_field', '');
-  if(!empty($append_field)) {
-    $field_values = $node->$append_field;
-    $default_description .= ' <span>' . $field_values[0]['value'] . '</span>';
-  }
-   
   $form['desc'] = array(
     '#type' => 'textfield',
     '#title' => t('Description (optional)'),
-    '#default_value' => $default_description,
+    '#default_value' => variable_get('img_assist_load_description', 1) ? $node->body : '',
     '#size' => 50,
-    '#maxlength' => 2000,
+    '#maxlength' => 255,
     '#description' => NULL,
     '#attributes' => array('onblur' => 'parent.updateCaption()'),
   );
@@ -1269,17 +1121,14 @@ function img_assist_display(&$node, $siz
     $label = IMAGE_THUMBNAIL;
   }
   
-  // label has been determined, go ahead and get the path
-  $path = _img_assist_imagefield_get_path($node, $label);
-  
   // Regenerate images if necessary.
   if (!isset($node->images[$label])) {
     $regen = TRUE;
   }
-  elseif (!is_file(file_create_path($path))) {
+  elseif (!is_file(file_create_path($node->images[$label]))) {
     $regen = TRUE;
   }
-  elseif (filemtime(file_create_path($path)) < variable_get('image_updated', 0)) {
+  elseif (filemtime(file_create_path($node->images[$label])) < variable_get('image_updated', 0)) {
     $regen = TRUE;
   }
   else {
@@ -1300,7 +1149,7 @@ function img_assist_display(&$node, $siz
       }
     }
     if (is_array($size)) {
-      $info = image_get_info(file_create_path($path));
+      $info = image_get_info(file_create_path($node->images[$label]));
       if (($info['width'] != $size['width']) && ($info['height'] != $size['height'])) {
         $regen = TRUE;
       }
@@ -1311,19 +1160,16 @@ function img_assist_display(&$node, $siz
     _img_assist_build_derivatives($node, $size);
   }
   
-  if (empty($node->images[$label]) && !_img_assist_imagefield_is($node)) {
+  if (empty($node->images[$label])) {
     return;
   }
   
   // Get actual size ($size is just a bounding box).
-  $info = image_get_info(file_create_path($path));
-  
+  $info = image_get_info(file_create_path($node->images[$label]));
   $attributes['class']  = 'image image-'. $label . (isset($attributes['class']) ? ' '. $attributes['class'] : '');
   $attributes['width']  = $info['width'];
   $attributes['height'] = $info['height'];
-  
-  $attributes = _img_assist_imagefield_attributes($node, $attributes, $size, $label);
-  return theme('image_display', $node, $label, file_create_url($path), $attributes);
+  return theme('image_display', $node, $label, file_create_url($node->images[$label]), $attributes);
 }
 
 /**
@@ -1336,17 +1182,11 @@ function img_assist_display(&$node, $siz
  *   An array containing the keys 'label', 'width', 'height'.
  */
 function _img_assist_build_derivatives(&$node, $size = NULL) {
-  // ignore this method if the node isn't an image node
-  if($node->type != 'image') {
-    return;
-  }
-  
-  $path = _img_assist_imagefield_get_path($node, IMAGE_ORIGINAL);
   // Verify the image module and toolkit settings.
   if (!_image_check_settings()) {
     return FALSE;
   }
-  $info = image_get_info(file_create_path($path));
+  $info = image_get_info(file_create_path($node->images[IMAGE_ORIGINAL]));
   
   // Custom size.
   if (is_array($size) && !empty($size['key']) && !empty($size['width']) && !empty($size['height'])) {
@@ -1372,8 +1212,7 @@ function _img_assist_build_derivatives(&
     
     if (is_array($size) && ($size['label']) && ($size['width']) && ($size['height'])) {
       if ($info['width'] > $size['width'] || $info['height'] > $size['height']) {
-        $source = file_create_path($path);
-        
+        $source = file_create_path($node->images[IMAGE_ORIGINAL]);
         $destination = _image_filename(basename($source), $key, FALSE);
         if (!image_scale($source, file_create_path($destination), $size['width'], $size['height'])) {
           drupal_set_message(t('Unable to create %label image', array('%label' => $size['label'])), 'error');
@@ -1384,18 +1223,17 @@ function _img_assist_build_derivatives(&
         }
       }
       else {
-        $node->images[$key] = $path;
+        $node->images[$key] = $node->images[IMAGE_ORIGINAL];
       }
     }
   }
 }
 
 function _img_assist_remove($node, $size) {
-  $path = _img_assist_imagefield_get_path($node, IMAGE_ORIGINAL);
   $result = db_query("SELECT * FROM {files} WHERE nid = %d AND filename = '%s'", $node->nid, $size['key']);
   while ($file = db_fetch_object($result)) {
     // Never delete original image.
-    if ($file->filepath != $path) {
+    if ($file->filepath != $node->images[IMAGE_ORIGINAL]) {
       // Delete image file.
       file_delete(file_create_path($file->filepath));
       // Delete file reference in database.
@@ -1412,7 +1250,6 @@ function img_assist_render_image($attrib
   
   if ($attributes['nid']) {
     $node = node_load($attributes['nid']);
-    $path = _img_assist_imagefield_get_path($node, IMAGE_ORIGINAL);
     
     // Get size.
     $width  = $attributes['width'];
@@ -1425,7 +1262,7 @@ function img_assist_render_image($attrib
       $height   = ($height <= $max_size[1]) ? $height : $max_size[1];
       
       // Get width and height of original size.
-      $original_size = image_get_info(file_create_path($path));
+      $original_size = image_get_info(file_create_path($node->images[IMAGE_ORIGINAL]));
       if ($width == $original_size['width'] && $height == $original_size['height']) {
         // Nothing to process, this is the original image size.
         $closest_std_size = IMAGE_ORIGINAL;
@@ -1433,7 +1270,7 @@ function img_assist_render_image($attrib
       }
       else {
         // Get width and height of preview size.
-        $preview_size   = image_get_info(file_create_path(_img_assist_imagefield_get_path($node, IMAGE_PREVIEW)));
+        $preview_size   = image_get_info(file_create_path($node->images[IMAGE_PREVIEW]));
         $preview_width  = $preview_size['width'];
         $preview_height = $preview_size['height'];
         
@@ -1735,7 +1572,7 @@ function _img_assist_textarea_match($for
     // all pages except those listed in img_assist_textareas. When set to 1, it
     // is displayed only on those textareas listed in img_assist_textareas.
     $page_match = !($must_match xor $page_match);
-    
+
     return $page_match;
   }
 }
@@ -1784,7 +1621,6 @@ function theme_img_assist_inline($node, 
   }
   // Change the node title because img_assist_display() uses the node title for
   // alt and title.
-  
   $node->title = strip_tags($caption);
   $img_tag = img_assist_display($node, $size);
   
@@ -1806,8 +1642,7 @@ function theme_img_assist_inline($node, 
   }
   elseif ($link == 'popup') {
     $popup_size = variable_get('img_assist_popup_label', IMAGE_PREVIEW);
-    $path       = _img_assist_imagefield_get_path($node, $popup_size);
-    $info       = image_get_info(file_create_path($path));
+    $info       = image_get_info(file_create_path($node->images[$popup_size]));
     $width      = $info['width'];
     $height     = $info['height'];
     $popup_url  = file_create_url($node->images[variable_get('img_assist_popup_label', IMAGE_PREVIEW)]);
@@ -1822,8 +1657,7 @@ function theme_img_assist_inline($node, 
   
   if ($caption) {
     if ($attributes['align'] != 'center') {
-      $path = _img_assist_imagefield_get_path($node, $size['key']);
-      $info = image_get_info(file_create_path($path));
+      $info = image_get_info(file_create_path($node->images[$size['key']]));
       // Reduce the caption width slightly so the variable width of the text
       // doesn't ever exceed image width.
       $width = $info['width'] - 2;
@@ -2084,161 +1918,3 @@ function theme_img_assist_legacy() {
  */
 
 
-/**
- * @defgroup img_assist_imagefield Image Assist imagefield helpers.
- * @{
- */
-
-/**
- * Returns the path to the image.  Works with both
- * image and imagefield nodes.
- */
-function _img_assist_imagefield_get_path($node, $label = IMAGE_PREVIEW) {
-  // Get path to image (checked for existance above)
-  $path = $node->images[$label]; // by default
-  
-  // handle imagefield if preference is set
-  // currently only handles one image attached via imagefield
-  if(variable_get('img_assist_use_imagefield', 0)) {
-    $field = _img_assist_imagefield_get_imagefield_name($node);
-    if ($field !== false) {
-      $tmp = $node->$field;
-      $path = file_create_path($tmp[0]['filepath']);
-    }
-  }
-  
-  return $path;
-}
-
-/**
- * Returns attributes with appropriate sizing. If empty populates it correctly.
- *
- * @param object $node node to handle
- * @param array $attributes original attributes array
- * @param string $label
- * @param array $size size array will update attributes if passed
- * @return array updated attributes array
- */
-function _img_assist_imagefield_attributes($node, $attributes, $size, $label = IMAGE_PREVIEW) {
-  $path = _img_assist_imagefield_get_path($node, $label);
-  
-  // first see if this is an imagefield, if so, proceed
-  if(!variable_get('img_assist_use_imagefield', 0) || !_img_assist_imagefield_is($node)) {
-    return $attributes;
-  }
-  
-  $attributes['class']  = 'image image-'. $label . (isset($attributes['class']) ? ' '. $attributes['class'] : '');
-  if(is_array($size) && isset($size['width']) && isset($size['height'])) {
-    $attributes['width'] = $size['width'];
-    $attributes['height'] = $size['height'];
-  }
-  elseif (isset($attributes['width']) && isset($attributes['height'])) {
-    // do nothing if the attributes are already set
-  }
-  else {
-    // need to add original size to list of sizes since image_get_sizes() won't handle
-    $sizes = image_get_sizes();
-    $info = image_get_info(file_create_path($path));
-    $sizes[IMAGE_ORIGINAL]['width'] = $info['width'];
-    $sizes[IMAGE_ORIGINAL]['height'] = $info['height'];
-    $attributes['width'] = $sizes[$label]['width'];
-    $attributes['height'] = $sizes[$label]['height'];
-  }
-  
-  return $attributes;
-}
-
-/**
- * Given a node, returns true if it is an imagefield
- * 
- * @param object $node
- * @return boolean
- */
-function _img_assist_imagefield_is($node) {
-  $field = _img_assist_imagefield_get_imagefield_name($node);
-  if($field === false) {
-    return false;
-  }
-  
-  $tmp = $node->$field;
-  return isset($tmp[0]);
-}
-
-/**
- * Given a node, searches through it to find the imagefield field...
- * ** MULTIPLE IMAGEFIELDS NOT SUPPORTED **
- *
- * @param unknown_type $node
- * @return mixed false if none, field name otherwise
- */
-function _img_assist_imagefield_get_imagefield_name($node) {
-  $query = "SELECT DISTINCT nf.field_name FROM {node_field_instance} nf, {node_type} nt WHERE nt.type = nf.type_name AND (nf.widget_type = 'image' OR nf.widget_type = 'image crop') AND nt.type = '%s' ORDER BY nt.name";
-  $result = db_query($query, array($node->type));
-  
-  // no imagefields associated with this node
-  if(!db_num_rows($result)) {
-    return false;
-  }
-  
-  // just grab the first one...
-  $row = db_fetch_object($result);
-  return $row->field_name;
-}
-
-/**
- * Given a type, searches through it to find the imagefield field...
- * ** MULTIPLE IMAGEFIELDS NOT SUPPORTED **
- *
- * @param unknown_type $node
- * @return mixed false if none, field name otherwise
- */
-function _img_assist_imagefield_get_imagefield_name_by_type($type) {
-  $query = "SELECT DISTINCT nf.field_name FROM {node_field_instance} nf, {node_type} nt WHERE nt.type = nf.type_name AND (nf.widget_type = 'image' OR nf.widget_type = 'image crop') AND nt.type = '%s' ORDER BY nt.name";
-  $result = db_query($query, array($type));
-  
-  // no imagefields associated with this node
-  if(!db_num_rows($result)) {
-    return false;
-  }
-  
-  // just grab the first one...
-  $row = db_fetch_object($result);
-  return $row->field_name;
-}
-
-/**
- * Returns array list of content types which include and imagefield.
- */
-function _img_assist_imagefield_get_content_types() {
-  $query = "SELECT DISTINCT nt.name, nt.type FROM {node_field_instance} nf, {node_type} nt WHERE nt.type = nf.type_name AND (nf.widget_type = 'image' OR nf.widget_type = 'image crop') ORDER BY nt.name";
-  $result = db_query($query);
-  
-  $options = array();
-  while ($row = db_fetch_object($result)) {
-    $options[$row->type] = $row->type;
-  }
-  
-  return $options;
-}
-
-/**
- * Gets all fields.
- * 
- * @param unknown_type $node
- * @return mixed false if none, field name otherwise
- */
-function _img_assist_imagefield_get_fields() {
-  $query = "SELECT DISTINCT nf.type_name, nf.field_name FROM {node_field_instance} nf ORDER BY type_name, field_name";
-  $result = db_query($query, array($type));
-  
-  $options = array();
-  while ($row = db_fetch_object($result)) {
-    $options[$row->field_name] = $row->type_name . ' - ' . $row->field_name;
-  }
-  
-  return $options;
-}
-
-/**
- * @} End of "defgroup img_assist_imagefield".
- */
\ No newline at end of file
