Downloading a feed's embedded images to server and rewriting paths in html automatically I'm scraping a some sites into a csv which is then used by feeds importer module to create Drupal content.

Some of the content are html chunks containing html+images in them which go into "body"/textarea kind of fields to be displayed.

How do I use feeds tamper or some other method to 


Download these embedded images to server and
Rewrite the image paths in the HTML chunks to point to server paths 




Possible solution:


Rewrite the paths in the html to internal paths registered via "hook_menu". When the path is called, if the image is not there, use "system_retrieve_file" to download the file and serve it .. Example hook_menu() implemented at image_menu. {Thanks Ciss @ drupal-support irc channel} Rewriting would be taken care of by feed_tamper that I have already.




To clarify - I know that if I use image urls with image fields, the images will be downloaded automatically. However I don't know how to download images that are within a HTML chunk.. thanks.
One possible solution is the feeds_imagegrabber module.

What is does is when the feed is importing it goes to the original web page of the feed item and scrapes the image from the page and imports it into drupal.

Depending on the specifics of your requirements this could be a good easy solution.