I need to look inside a string of HTML and change all <img>
tags where the src
attribute is a relative address, to an absolute URL. So this:
<img src="puppies.jpg">
needs to become:
<img src="http://sitename.com/path/puppies.jpg">
while ignoring <img>
tags whose src
attribute is already absolute.
I'm using PHP and assume that I'll need to run this through preg_replace()
. Help! And Thanks!