If you use jQuery, you could try a little workaround to display your images.
Not a very elegant way, but should work for small projects.
I started with a little php function to get my newsposts and generate the markup:
function getNewsfeed(){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://example.com/service-pages/?template=news&sort=-modified&limit=5'
));
$result = curl_exec($curl);
curl_close($curl);
$data = '';
$result = json_decode($result, true);
if($result){
foreach($result[matches] as $news){
$data .='<div class="js-newsfeedentry s-newsfeedentry">';
$data .='<h3>'.$news[title].'<small class="pull-right text-muted" style="padding-top:5px">Posted : '.date("d.m.Y - H:i",$news[created]).'</small></h3>';
$data .= $news[text];
$data .='<hr />';
$data .='</div>';
}
}
return $data;
}
as you can see, I wrap the entire newspost into a div with the class "js-newsfeed".
Now we iterate over all images inside this div and manipulate the img src, to match the correct url from the web-service.
Inside our document ready function we grab all news images and correct the src:
/* fix urls for newsfeed img */
var newsfeedimg = $('.js-newsfeed img');
newsfeedimg.each(function(){
var newimgsrc = 'http://example.com'+$(this).attr('src');
$(this).attr('src',newimgsrc);
});
et voila, working images.
Remember that this isn´t a very good solution because you iterate over every image in your newspost via JavaScript and you shouldn´t do this on a project with many images.