How do I add a custom field to the image field widget in Drupal 7? I need to add a custom field (a simple text field) to the image_field widget in Drupal 7.

The structure is a standard node (called Article) which has zero or more images (related photos or graphics) attached via the image_field widget. The field I want to add is the source of the image, and is used later to figure out when it needs to be deleted.

I've tried the code from this post, but couldn't get it to work.
Attaching metadata to images and other media, is precisely the reason that prompted the creation of the media module. We use the unfortunately "unstable" version ourselves, with good results. Using Media, your images becomes entities, allowing you to attach any field you want to them through the normal means.
While the solution to manipulate the existing widget is fully valid, it will require quite a bit of understanding of the Field API, and I believe any such solution would get rather messy.