Downloading web image directly into a media file
Jamroom Developers
Take a look at the jrUrlScan module, it sounds similar to what you're after. It scans text to look for URL's and if it finds one it queues it up to have that page checked for any og:tags in the page in order to get images and info out of that location. The images are then saved locally.
The function that does the getting is jrUrlScan_update_url_card() in the include.php file.