? test.patch
Index: contrib/image_attach/image_attach.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_attach/image_attach.module,v
retrieving revision 1.9.2.16
diff -u -r1.9.2.16 image_attach.module
--- contrib/image_attach/image_attach.module	16 Jul 2007 16:23:39 -0000	1.9.2.16
+++ contrib/image_attach/image_attach.module	8 Aug 2007 16:39:56 -0000
@@ -191,6 +191,13 @@
       $image->name = $node->name;
       $image->created = $node->created;
       $image->type = 'image';
+      // Set the node's defaults... (copied this from node and comment.module)
+      $node_options = variable_get('node_options_image', array('status', 'promote'));
+      $node->status = in_array('status', $node_options);
+      $node->promote = in_array('promote', $node_options);
+      if (module_exists('comment')) {
+        $node->comment = variable_get('comment_image', COMMENT_NODE_READ_WRITE);
+      }
       image_prepare($image, 'image');
       if ($image->images) {
         if (empty($image->title)) {
@@ -376,6 +383,10 @@
     drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
 
     $image = node_load($node->iid);
+    if (!node_access('view', $image)) 
+      // If the image is restricted, don't show it as an attachment.
+      return NULL;
+    }
     $info = image_get_info(file_create_path($image->images[$img_size]));
 
     $output = '<div style="width: '. $info['width'] .'px" class="image-attach-teaser">';
@@ -396,6 +407,10 @@
     drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');
 
     $image = node_load($node->iid);
+    if !node_access('view', $image)) 
+      // If the image is restricted, don't show it as an attachment.
+      return NULL;
+    }
     $info = image_get_info(file_create_path($image->images[$img_size]));
 
     $output = '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
