How many images are you having to work with?
There are many different things going on here that you will have to account for.
-making sure the script can recognize each url as a link
-get the location within the document where the url is (create a bookmark?)
-copying the url text
-using the url text to actually fetch the image it points to (including making sure the script has permissions to access the site where the image is located)
-inserting the image at the proper location within the document
-ensuring the image is the proper size that you want, and the text around it is flowing properly
etc etc