Working version.

This version will rewrite any images that are uploaded to a post as an
attachment, or are referenced within a post/page.