If an image is not attached and the image module is uploaded there should be some sort of validation step. Certainly that field is manditory according to the form. However, as my client says it "GLAD I DID THE TEST BECAUSE I DID NOT SUBMIT A PHOTO WITH MY APPLICATION AND YET IT TOOK IT AND THANKED ME ANYWAYS. IMPORTANT THAT IF A JPG IMAGE IS NOT ATTACHED, THAT THERE IS AN ERROR MESSAGE THAT APPEARS"

So why does the image module allow you to upload a node with no images?

Mike

CommentFileSizeAuthor
#6 image_55414.patch619 bytesdrewish

Comments

mgifford’s picture

Status: Active » Needs review

Drupal.org didn't like the diff I tried to paste in here.. I posted it here instead:
http://www.openconcept.ca/forcing_the_drupal_4_6_image_module_to_acutall...

Stefan Nagtegaal’s picture

Version: 4.6.x-1.x-dev » 6.x-1.x-dev
Assigned: Unassigned » Stefan Nagtegaal
Status: Needs review » Active

Thi does not seem to be the best way todo things around here. I'll make a patch tomorrow morning based on the CVS verasion of image.module which will fix this and ask Walkah to have a look at it and commit it.

Because the bug is reproducable in HEAD I changed the "Version"..

Steef

gaele’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev

The bug is still there. And I found a variation of this bug:

If the image selected for upload is larger than the PHP settings allow image.module also says "Your Image has been created." Very confusing for end-users.

5.x-1.0 gives no further error message whatsoever.
5.x-1.x-dev says "The selected file /var/www/drupal/sites/default/files could not be copied."

drewish’s picture

yeah that does seem to be a bug. at least there's not a red star indicating a required field though ;)

alvin’s picture

I added the following to validate:

function image_validate(&$node) {
  if (empty($node->images[IMAGE_ORIGINAL]))
    form_set_error('Image', t('You have not included an image.'));
  return;
}
drewish’s picture

Status: Active » Fixed
StatusFileSize
new619 bytes

thanks alvin. i cleaned up a few style issues and committed the attached to HEAD and DRUPAL-5.

Anonymous’s picture

Status: Fixed » Closed (fixed)