--- inline.module.orig	2007-04-07 15:52:40.171435100 +0200
+++ inline.module	2007-04-07 16:20:02.090707700 +0200
@@ -117,15 +117,38 @@ function inline_settings() {
   return system_settings_form($form);
 }
 
+/**
+ * Implementation of hook_form_alter()
+ */
 function inline_form_alter($form_id, &$form) {
   if ($form_id == 'node_type_form') {
     $node_type = $form['orig_type']['#value'];
-    $form['workflow']['upload_inline'] = array(
+    $form['inline'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Inline Images'),
+      '#collapsible' => TRUE,
+    );
+    $form['inline']['upload_inline'] = array(
       '#type' => 'radios',
       '#title' => t('Display attachments inline automatically'),
       '#default_value' => variable_get('upload_inline_'. $node_type, 0),
-      '#options' => array(t('Disabled'), t('Only in teaser'), t('Only in body'), t('In teaser and body')),
-      '#description' => t('Whether or not uploaded images should be shown inline. Make sure you set the dimensions at !settings_url', array('!settings_url' => l(t('inline settings'), 'admin/settings/inline'))),
+      '#options' => array(
+        0 => t('Disabled'),
+        1 => t('Only in teaser view'),
+        2 => t('Only in body view'),
+        3 => t('In teaser and body view')),
+      '#description' => t('Choose whether uploaded images should be shown inline automatically. Make sure you set the dimensions at !settings_url', array('!settings_url' => l(t('inline settings'), 'admin/settings/inline'))),
+    );
+    $form['inline']['inline_position'] = array(
+      '#type' => 'radios',
+      '#title' => t('Position of inline images'),
+      '#default_value' => variable_get('inline_position_'. $node_type, 'above'),
+      '#options' => array(
+        'hide' => t('Do not show'),
+        'above' => t('Show above node body'),
+        'below' => t('Show below node body'),
+        'template' => t('Manually output in node template by variable $node->inline_images')),
+      '#description' => t('The position of automatically inlined images in the node view.'),
     );
   }
 }
@@ -174,7 +197,7 @@ function inline_filter_tips($delta, $for
   }
 }
 
-function inline_nodeapi(&$node, $op, $arg) {
+function inline_nodeapi(&$node, $op, $arg, $page = false) {
   if (!is_array($node->files)) {
     return;
   }
@@ -190,7 +213,7 @@ function inline_nodeapi(&$node, $op, $ar
         }
       }
       if (variable_get('upload_inline_'. $node->type, 0)) {
-        $node = _inline_auto_add($node);
+        _inline_auto_add($node, $page);
       }
       return;
     
@@ -281,61 +304,50 @@ function theme_inline_img($file, $field)
   return $html;
 }
 
-function theme_inline_add_to_teaser($node, $file, $field) {
-  return theme('inline_img', $file, $field) . $node->teaser;
-}
-
-function theme_inline_add_to_body($node, $file, $field) {
-  return theme('inline_img', $file, $field) . $node->body;
-}
+function _inline_auto_add(&$node, $page) {
+  // Check for which views inline_auto_add is enabled.
+  $fields = array(
+    0 => array(),
+    1 => array('teaser'),
+    2 => array('body'),
+    3 => array('teaser', 'body'),
+  );
+  $fields = $fields[variable_get('upload_inline_'. $node->type, 0)];
+  // Convert $page into the actual node field.
+  $field = $page ? 'body' : 'teaser';
+  // Only proceed if the current view is in the set of enabled views.
+  if (!in_array($field, $fields)) {
+    return;
+  }
+  // Generate output of inline images.
+  $output = '';
+  foreach ($node->files as $fid => $file) {
+    $file = inline_prepare_file_object($file);
+    if (_inline_decide_img_tag($file)) {
+      $node->files[$fid]->inline = TRUE;
+      $output .= theme('inline_img', $file, $field);
+    }
+  }
+  $output = '<div class="inline-images">'. $output .'</div>';
 
-function _inline_auto_add($node) {
-  //0 Disabled
-  //1 Only in teaser
-  //2 Only in body
-  //3 In teaser and body
-  switch (variable_get('upload_inline_'. $node->type, 0)) {
-    case 1:
-      foreach ($node->files as $fid => $file) {
-        $file = inline_prepare_file_object($file);
-        if (_inline_decide_img_tag($file)) {
-          $node->files[$fid]->inline = TRUE;
-          $node->teaser = theme('inline_add_to_teaser', $node, $file, 'teaser');
-        }
-        else {
-          $node->files[$fid]->inline = FALSE;
-        }
-      }
+  // Add inline images to the node, depending on content type settings.
+  switch (variable_get('inline_position_'. $node->type, 'above')) {
+    case 'hide':
       break;
     
-    case 2:
-      foreach ($node->files as $fid => $file) {
-        $file = inline_prepare_file_object($file);
-        if (_inline_decide_img_tag($file)) {
-          $node->files[$fid]->inline = TRUE;
-          $node->body = theme('inline_add_to_body', $node, $file, 'body');
-        }
-        else {
-          $node->files[$fid]->inline = FALSE;
-        }
-      }
+    case 'template':
+      $node->inline_images = $output;
       break;
     
-    case 3:
-      foreach ($node->files as $fid => $file) {
-        $file = inline_prepare_file_object($file);
-        if (_inline_decide_img_tag($file)) {
-          $node->files[$fid]->inline = TRUE;
-          $node->teaser = theme('inline_add_to_teaser', $node, $file, 'teaser');
-          $node->body = theme('inline_add_to_body', $node, $file, 'body');
-        }
-        else {
-          $node->files[$fid]->inline = FALSE;
-        }
-      }
+    case 'below':
+      $node->$field = $node->$field . $output;
+      break;
+    
+    case 'above':
+    default:
+      $node->$field = $output . $node->$field;
       break;
   }
-  return $node;
 }
 
 function _inline_substitute_tags(&$node, $field) {
