--- /c/projects/drupal/cvs-47/contributions/modules/image/contrib/image_attach/image_attach.module	2006-09-09 10:49:50.718750000 -0400
+++ modules/image/contrib/image_attach/image_attach.module	2006-09-26 00:13:36.953125000 -0400
@@ -119,6 +119,71 @@ function image_attach_nodeapi(&$node, $o
 }
 
 /**
+ * Implementation of hook_views_tables().
+ */
+function image_attach_views_tables() {
+  $tables['image_attach'] = array(
+    'name' => 'image_attach',
+    'join' => array(
+      'left' => array(
+        'table' => 'node',
+        'field' => 'nid'
+      ),
+      'right' => array(
+        'field' => 'nid'
+      ),
+    ),
+    'fields' => array(
+      'iid' => array(
+        'name' => t('Image Attach: Display Image'),
+        'handler' => array(
+          'image_attach_views_handler_field_iid' => t('Image'),
+          'image_attach_views_handler_field_iid_link_node' => t('Image with link to attaching node'),
+          'image_attach_views_handler_field_iid_link_image' => t('Image with link to attached image'),
+        ),
+        'option' => array(
+          '#type' => 'select',
+          '#options' => 'image_views_handler_filter_image_size',
+        ),
+        'sortable' => FALSE,
+      ),
+    ),
+  );
+  
+  return $tables;
+}
+
+/**
+ * Views handler for displaying the image.
+ */
+function image_attach_views_handler_field_iid($field_info, $field_data, $value, $data) {
+  if ($value) {
+    $image = node_load($value);
+    return image_display($image, $field_data['options']);
+  }
+}
+
+/**
+ * Views handler for displaying the image in a link to the image node that attaches the image.
+ */
+function image_attach_views_handler_field_iid_link_node($field_info, $field_data, $value, $data) {
+  if ($value) {
+    $image = node_load($value);
+    return l(image_display($image, $field_data['options']), 'node/'. $data->nid, array(), NULL, NULL, FALSE, TRUE);
+  }
+}
+
+/**
+ * Views handler for displaying the image in a link to the attached image.
+ */
+function image_attach_views_handler_field_iid_link_image($field_info, $field_data, $value, $data) {
+  if ($value) {
+    $image = node_load($value);
+    return l(image_display($image, $field_data['options']), 'node/'. $value, array(), NULL, NULL, FALSE, TRUE);
+  }
+}
+
+/**
  * Theme the teaser.
  *
  * Override this in template.php to include a case statement if you want different node types to appear differently.
