Reputation: 1665
I am displaying an image like this way
<?php foreach($result $as $items){
echo '<img src="<?php echo $items['hoteldetail']['images']['image']['imagepath']; ?>" >';
}
But it dosen't show the image when i check the source it is mixed with localhost address
Here is the thing i will get from the inspect element
localhost/holiday/hotel/cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/qyj/ibt/HO.jpg
But actually the this is the image url
cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/qyj/ibt/HO.jpg
Why this is happening?
Upvotes: 2
Views: 130
Reputation: 16117
Add http://
protocol in your image source for external web access:
<?
foreach($result $as $items){
?>
<img src="http://<?=$items['hoteldetail']['images']['image']['imagepath'];?>">
<?php
}
?>
Upvotes: 1
Reputation: 2928
You are using inside echo. Try like below:
echo '<img src="//'.$items['hoteldetail']['images']['image']['imagepath'].'" >';
Upvotes: 1
Reputation: 2408
<?php foreach($result $as $items){
echo '<img src="http://'. $items['hoteldetail']['images']['image']['imagepath'] .'" >';// mark http:// here
}
source it is mixed with localhost address
Please enter http://
either manually or update your database and remember to enter it next time when you use a new url other then base url
Upvotes: 0