added a simple method to allow all subclasses to easily relocate image links
This commit is contained in:
parent
e564559bda
commit
0fa32c7cf9
1 changed files with 11 additions and 0 deletions
|
@ -71,6 +71,17 @@ abstract class BridgeAbstract implements BridgeInterface{
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default image SRC attribute to point on given server when none is provided (that's to say when image src starts with '/'
|
||||||
|
*/
|
||||||
|
public function defaultImageSrcTo($content, $server) {
|
||||||
|
foreach($content->find('img') as $image) {
|
||||||
|
if(strpos($image->src, '/')==0) {
|
||||||
|
$image->src = $server.$image->src;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue