I have this function to ensure every img tag has absolute URL:
function absoluteSrc($html, $encoding = \'utf-8\')
{
$dom = new DOMDocume
An alternative solution is to use DOMDocument->saveHTMLFile() (which doesn't convert HTML entities) and read the contents of the saved file back into a string.
It's not super pretty, but it has the advantage of not having to manually find-and-replace entity codes yourself (twice) as per some other solutions proffered here.