Index: image_attach.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_attach/image_attach.module,v
retrieving revision 1.9.2.2
diff -u -F^function -r1.9.2.2 image_attach.module
--- image_attach.module	13 Jan 2007 06:19:50 -0000	1.9.2.2
+++ image_attach.module	18 Jan 2007 05:53:18 -0000
@@ -238,6 +238,16 @@ function image_attach_views_tables() {
         'sortable' => FALSE,
       ),
     ),
+    'filters' => array(
+      'iid' => array(
+        'name' => t('Image Attach: Attached image'),
+        'operator' => array('=' => t('Exists')),
+        'list' => 'views_handler_operator_yesno',
+        'list-type' => 'select',
+        'handler' => 'image_attach_views_handler_filter_iid_exist',
+        'help' => t('Filter by whether or not the node has an attached image.'),
+      ),
+    ),
   );
   
   return $tables;
@@ -274,6 +284,22 @@ function image_attach_views_handler_fiel
 }
 
 /**
+ * Views handler for filtering whether or not the node has an attached image.
+ */
+function image_attach_views_handler_filter_iid_exist($op, $filter, $filterdata, &$query) {
+  switch ($op) {
+    case 'handler':
+      $query->ensure_table('image_attach');
+      if ($filter['value']) {
+        $query->add_where('image_attach.iid');
+      }
+      else {
+        $query->add_where('ISNULL(image_attach.iid)');
+      }
+  }
+}
+
+/**
  * Theme the teaser.
  *
  * Override this in template.php to include a case statement if you want different node types to appear differently.
