From 0fa32c7cf9d3ab947766c986119372f737769654 Mon Sep 17 00:00:00 2001 From: Nicolas Delsaux Date: Wed, 26 Mar 2014 16:04:10 +0100 Subject: [PATCH] added a simple method to allow all subclasses to easily relocate image links --- lib/Bridge.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Bridge.php b/lib/Bridge.php index 75f470e..4467da0 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -71,6 +71,17 @@ abstract class BridgeAbstract implements BridgeInterface{ 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; + } + } + } } /**