$regex = '/http/';

$matches = array();
 
if(preg_match($regex, $img, $matches)){
$r=$img;
}else{

$r=str_replace("/editor","http://www.lhlg.net/editor",$img);
 }