Codice PHP:
$base_url "http://www.sito.it";
$stringa preg_replace("/<img(.+?)src=\"/i""<img$1src=\"$base_url"$stringa_da_modificare);