--- image_attach.module.original	Wed May 16 09:56:55 2007
+++ image_attach.module.modified	Wed May 16 20:22:48 2007
@@ -61,25 +61,50 @@
   // Content type settings form.
   if ($form_id == 'node_type_form' && $form['#node_type']->type != 'image') {
     _image_check_settings();
+    $allsizes = array();
+    $allsizes['_original'] = t('Original');
+    foreach (_image_get_sizes() as $size) {
+      $allsizes[$size['label']] = $size['label'];
+    }
+    $allsizes['hidden'] = t('Hidden');
     $form['workflow']['image_attach'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Image Attach settings'),
+      '#collapsible' => TRUE,
+    );
+    $form['workflow']['image_attach']['image_attach'] = array(
       '#type' => 'radios',
       '#title' => t('Attach Images'),
       '#default_value' => variable_get('image_attach_'. $form['#node_type']->type, 0),
       '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
       '#description' => t('Should this node allows users to upload an image?'),
     );
-    $form['workflow']['image_attach_weight_teaser'] = array(
+    $form['workflow']['image_attach']['image_attach_weight_teaser'] = array(
       '#type' => 'weight',
       '#title' => t('Attached image teaser weight'),
       '#default_value' => variable_get('image_attach_weight_teaser_'. $form['#node_type']->type, 0),
       '#description' => t("This value determines the image's weight in the teaser."),
     );
-    $form['workflow']['image_attach_weight_body'] = array(
+    $form['workflow']['image_attach']['image_attach_weight_body'] = array(
       '#type' => 'weight',
       '#title' => t('Attached image body weight'),
       '#default_value' => variable_get('image_attach_weight_body_'. $form['#node_type']->type, 0),
       '#description' => t("This value determines the image's weight in the body."),
     );
+    $form['workflow']['image_attach']['image_attach_size_teaser'] = array(
+      '#type' => 'select',
+      '#title' => t('Attached image teaser size'),
+      '#default_value' => variable_get('image_attach_size_teaser_'. $form['#node_type']->type, 'thumbnail'),
+    '#options' => $allsizes,
+      '#description' => t("This value determines the image's size will appear in teaser nodes. 'Hidden' will not show the image.")
+    );  
+    $form['workflow']['image_attach']['image_attach_size_body'] = array(
+      '#type' => 'select',
+      '#title' => t('Attached image body size'),
+      '#default_value' => variable_get('image_attach_size_body_'. $form['#node_type']->type, 'thumbnail'),
+      '#options' => $allsizes,
+      '#description' => t("This value determines the image's size will appear in the body. 'Hidden' will not show the image.")
+    );  
   }
   // Node edit form.
   else if (isset($form['type']) && $form['type']['#value'] != 'image') {
@@ -323,14 +348,18 @@
  * If you have additional image sizes you defined in image.module, you can use them by theming this function as well.
  */
 function theme_image_attach_teaser($node) {
-  drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
-
-  $image = node_load($node->iid);
-  $info = image_get_info(file_create_path($image->images['thumbnail']));
-
-  $output = '<div style="width: '. $info['width'] .'px" class="image-attach-teaser">';
-  $output .= l(image_display($image, 'thumbnail'), "node/$node->nid", array(), NULL, NULL, FALSE, TRUE);
-  $output .= '</div>'."\n";
+  $img_size = variable_get('image_attach_size_teaser_'. $node->type, 'thumbnail');
+  
+  if ($img_size != 'hidden') {
+    drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
+
+ 	 $image = node_load($node->iid);
+    $info = image_get_info(file_create_path($image->images[$img_size]));
+
+    $output = '<div style="width: '. $info['width'] .'px" class="image-attach-teaser">';
+    $output .= l(image_display($image, $img_size), "node/$node->nid", array(), NULL, NULL, FALSE, TRUE);
+    $output .= '</div>'."\n";
+  }
   return $output;
 }
 
@@ -338,14 +367,18 @@
  * Theme the body
  */
 function theme_image_attach_body($node) {
-  drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
-
-  $image = node_load($node->iid);
-  $info = image_get_info(file_create_path($image->images['thumbnail']));
-
-  $output = '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
-  $output .= l(image_display($image, 'thumbnail'), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
-  $output .= '</div>'."\n";
+  $img_size = variable_get('image_attach_size_body_'. $node->type, 'thumbnail');
+
+  if ($img_size != 'hidden') {
+    drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
+
+    $image = node_load($node->iid);
+    $info = image_get_info(file_create_path($image->images[$img_size]));
+
+    $output = '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
+    $output .= l(image_display($image, $img_size), "node/$node->iid", array(), NULL, NULL, FALSE, TRUE);
+    $output .= '</div>'."\n";
+  }
   return $output;
 }
 
