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.67
diff -u -p -r1.67 image_attach.module
--- contrib/image_attach/image_attach.module	17 Sep 2009 19:01:39 -0000	1.67
+++ contrib/image_attach/image_attach.module	18 Sep 2009 20:18:55 -0000
@@ -294,12 +294,23 @@ function image_attach_image_add_submit(&
 }
 
 /**
+ * Image attach validation handler for node edit form.
+ *
+ * Limit the number of attached images.
  * Capture node form submission and immediately create an image if one has been
  * uploaded.
  * Note that the new image nodes are created even on preview. Taking several
  * attempts may create trash.
  */
 function image_attach_validate(&$form, &$form_state) {
+  // Limit the number of attached images. Filter out the 'None' with array_filter.
+  $limit = 1;
+  $num_images = count(array_filter($form_state['values']['iids']));
+  if ($num_images > $limit) {
+    form_set_error('image_attach', 'You may not attach more than 1 image.');    
+  }
+ 
+  // Validate and save the uploaded image.
   $validators = array(
     'file_validate_is_image' => array(),
   );
