diff -rup image/contrib/image_attach/image_attach.install image_new/contrib/image_attach/image_attach.install
--- image/contrib/image_attach/image_attach.install	2010-08-04 03:43:00.000000000 +1000
+++ contrib/image_attach/image_attach.install	2010-09-19 17:35:16.000000000 +1000
@@ -15,6 +15,13 @@ function image_attach_schema() {
         'not null' => TRUE,
         'default' => 0,
       ),
+      'vid' => array(
+        'description' => 'The {node}.vid of the node.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
       'iid' => array(
         'description' => 'The {image}.nid of the image file.',
         'type' => 'int',
@@ -29,9 +36,10 @@ function image_attach_schema() {
         'default' => 0,
       ),
     ),
-    'primary key' => array('nid', 'iid'),
+    'primary key' => array('vid', 'iid'),
     'indexes' => array(
       'iid' => array('iid'),
+      'nid' => array('nid'),
     ),
   );
   return $schema;
@@ -160,3 +168,24 @@ function image_attach_update_6103() {
   return $ret;
 }
 
+/**
+ * Add node vid so we attach at the revision level.
+ */
+function image_attach_update_6104() {
+  $ret = array();
+  db_add_field($ret, 'image_attach', 'vid', array(
+    'description' => 'The {node}.vid of the node.',
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+    'default' => 0,
+  ));
+
+  db_drop_primary_key($ret, 'image_attach');
+  db_add_primary_key($ret, 'image_attach', array('vid', 'iid'));
+  db_add_index($ret, 'image_attach', 'nid', array('nid'));
+
+  // Set vid for existing rows.
+  $ret[] = update_sql("UPDATE {image_attach} i SET i.vid = (SELECT n.vid FROM {node} n WHERE n.nid = i.nid)");
+  return $ret;
+}
diff -rup image/contrib/image_attach/image_attach.module image_new/contrib/image_attach/image_attach.module
--- image/contrib/image_attach/image_attach.module	2010-09-17 00:08:04.000000000 +1000
+++ contrib/image_attach/image_attach.module	2010-09-19 17:45:20.000000000 +1000
@@ -298,17 +298,6 @@ function image_attach_form_alter(&$form,
  * node edit form directly afterwards, without creating the new node yet.
  */
 function image_attach_image_add_submit(&$form, &$form_state) {
-  // Rebuild the attached image data.
-  if (isset($form_state['values']['iids'])) {
-    db_query("DELETE FROM {image_attach} WHERE nid = %d", $form['nid']['#value']);
-    if (count($form_state['values']['iids'])) {
-      $weight = 0;
-      foreach ($form_state['values']['iids'] as $iid) {
-        db_query("INSERT INTO {image_attach} (nid, iid, weight) VALUES (%d, %d, %d)", $form['nid']['#value'], $iid, $weight++);
-      }
-    }
-  }
-
   // Convert taxonomy format from Preview to Object.
   if (module_exists('taxonomy') && !empty($form_state['values']['taxonomy'])) {
     $temp_node = new stdClass();
@@ -409,12 +398,15 @@ function image_attach_nodeapi(&$node, $o
   switch ($op) {
     case 'insert':
     case 'update':
-      db_query("DELETE FROM {image_attach} WHERE nid = %d", $node->nid);
+      // If we are not creating a new revision, replace the existing revision's attached images.
+      if (!$node->revision) {
+        db_query("DELETE FROM {image_attach} WHERE vid = %d", $node->vid);
+      }
       if (!empty($node->iids)) {
         // Populate weight column with placeholder values.
         $weight = 0;
         foreach ($node->iids as $iid) {
-          db_query("INSERT INTO {image_attach} (nid, iid, weight) VALUES (%d, %d, %d)", $node->nid, $iid, $weight++);
+          db_query("INSERT INTO {image_attach} (nid, vid, iid, weight) VALUES (%d, %d, %d, %d)", $node->nid, $node->vid, $iid, $weight++);
         }
       }
       break;
@@ -424,7 +416,7 @@ function image_attach_nodeapi(&$node, $o
       break;
 
     case 'load':
-      $res = db_query("SELECT iid FROM {image_attach} WHERE nid = %d ORDER BY weight", $node->nid);
+      $res = db_query("SELECT iid FROM {image_attach} WHERE vid = %d ORDER BY weight", $node->vid);
       $iids = array();
       while ($iid = db_fetch_array($res)) {
         $iids[] = $iid['iid'];
diff -rup image/contrib/image_attach/image_attach_views_handler_field_attached_images.inc image_new/contrib/image_attach/image_attach_views_handler_field_attached_images.inc
--- image/contrib/image_attach/image_attach_views_handler_field_attached_images.inc	2010-08-04 03:43:00.000000000 +1000
+++ contrib/image_attach/image_attach_views_handler_field_attached_images.inc	2010-09-19 17:26:37.000000000 +1000
@@ -15,14 +15,14 @@ class image_attach_views_handler_field_a
   /**
    * Constructor to provide additional fields to add.
    *
-   * Add the nid field for our query later on.
+   * Add the vid field for our query later on.
    */
   function construct() {
     parent::construct();
 
-    $this->additional_fields['image_attach_nid'] = array(
+    $this->additional_fields['image_attach_vid'] = array(
       'table' => 'node',
-      'field' => 'nid',
+      'field' => 'vid',
     );
   }
 
@@ -63,26 +63,26 @@ class image_attach_views_handler_field_a
   function pre_render(&$values) {
     $nids = array();
     foreach ($values as $v) {
-      if (isset($v->{$this->aliases['image_attach_nid']})) {
-        // Make the nid safe.
-        $nid = intval($v->{$this->aliases['image_attach_nid']});
-        // Use the nid as the key to make the values unique.
-        $nids[$nid] = $nid;
+      if (isset($v->{$this->aliases['image_attach_vid']})) {
+        // Make the vid safe.
+        $vid = intval($v->{$this->aliases['image_attach_vid']});
+        // Use the vid as the key to make the values unique.
+        $vids[$vid] = $vid;
       }
     }
 
-    if (count($nids)) {
-      $nids_string = implode(',', $nids);
-      $result = db_query("SELECT nid, iid FROM {image_attach} WHERE nid IN (" . $nids_string . ") ORDER BY weight");
+    if (count($vids)) {
+      $vids_string = implode(',', $vids);
+      $result = db_query("SELECT vid, iid FROM {image_attach} WHERE vid IN (" . $vids_string . ") ORDER BY weight");
       while ($data = db_fetch_object($result)) {
         // Store all the attached image nids (iid) keyed by attaching nid.
-        $attached_images[$data->nid][] = $data->iid;
+        $attached_images[$data->vid][] = $data->iid;
       }
 
       // Place the data into the $values array for each result.
       foreach ($values as $id => $v) {
-        if (isset($attached_images[$v->{$this->aliases['image_attach_nid']}])) {
-          $values[$id]->image_attach_iids = $attached_images[$v->{$this->aliases['image_attach_nid']}];
+        if (isset($attached_images[$v->{$this->aliases['image_attach_vid']}])) {
+          $values[$id]->image_attach_iids = $attached_images[$v->{$this->aliases['image_attach_vid']}];
         }
       }
     }
@@ -103,7 +103,7 @@ class image_attach_views_handler_field_a
         'link' => $this->options['as_link'],
       );
 
-      $output = theme('image_attach_attached_images', $values->{$this->aliases['image_attach_nid']}, $image_nodes, $options);
+      $output = theme('image_attach_attached_images', $values->{$this->aliases['image_attach_vid']}, $image_nodes, $options);
 
       return $output;
     }
diff -rup image/contrib/image_attach/image_attach.views.inc image_new/contrib/image_attach/image_attach.views.inc
--- image/contrib/image_attach/image_attach.views.inc	2010-08-04 03:43:00.000000000 +1000
+++ contrib/image_attach/image_attach.views.inc	2010-09-19 16:58:16.000000000 +1000
@@ -16,8 +16,8 @@ function image_attach_views_data() {
   // LEFT is the default, but let's be explicit
   $data['image_attach']['table']['join'] = array(
     'node' => array(
-      'left_field' => 'nid',
-      'field' => 'nid',
+      'left_field' => 'vid',
+      'field' => 'vid',
       'type' => 'LEFT',
     ),
   );
@@ -43,7 +43,7 @@ function image_attach_views_data() {
 
   // 'Reverse' relationship for attached images.
   // This goes from attached image nodes to image attach and thence to nodes,
-  // but joining first on iid, and only then on nid.
+  // but joining first on iid, and only then on vid.
   // In other words, given the image, what node(s) have it as an attached image?
   $data['image_attach_reverse']['table']['group'] = t('Image attach');
 
@@ -55,7 +55,7 @@ function image_attach_views_data() {
       'type' => 'LEFT',
     ),
   );
-  $data['image_attach_reverse']['nid'] = array(
+  $data['image_attach_reverse']['vid'] = array(
     'title' => t('Attaching nodes'),
     'help' => t('The nodes that have attached images.'),
     'relationship' => array(
@@ -63,9 +63,9 @@ function image_attach_views_data() {
       'label' => t('Attaching nodes'),
       'help' => t("The nodes that have attached images. This relationship should be used on a view of image nodes, to get to their attaching 'parent' nodes."),
       'base' => 'node',
-      'base field' => 'nid',
+      'base field' => 'vid',
       'relationship table' => 'image_attach_reverse',
-      'relationship field' => 'nid',
+      'relationship field' => 'vid',
       'handler' => 'views_handler_relationship',
     ),
   );
