Reputation: 61
<?php
$images= $uploading['front_image'];
$whileimg= explode(",", $images);
foreach ($whileimg as $key => $image) {
echo $uploading["front_image"];
}
?>
In database I have my images saved in one column(2,3,4 it depends). now when I want them all to show in web ,Instead of images I get the path of the photos, as are saved in database. thank you
Upvotes: 0
Views: 1752
Reputation: 1198
Assuming you are fetching comma separated paths of images using the following line:
$images= $uploading['front_image'];
You just need to use the following loop after creating array of paths:
foreach ($whileimg as $key => $image) {
echo "<img src='$image'>";
}
Upvotes: 0
Reputation: 2302
You need to make it an image take and echo the path in the img is what it sounds like you're getting:
echo "<img src='".$image."' />
instead of
echo $uploading["front_image"];
So:
<?php
$images= $uploading['front_image'];
$whileimg= explode(",", $images);
foreach ($whileimg as $key => $image) {
echo "<img src='".$image."' />
}
?>
Upvotes: 1
Reputation: 3879
To display images, you have use img tag
foreach ($whileimg as $key => $image) {
echo "<img src='".$image."' alt='image'>";
}
Upvotes: 1