How To Display Multiples Images From MySql
I would like to know how to display multiples images from MySQL in Html. I have two files: photogallery.php where I display the image and gallery.php where I have the php code. Th
Solution 1:
If you have image data stored on the database with a function like get_file_contents :
while($row= mysql_fetch_assoc($query)){
$imageData=$row["image"];
echo "<div align='left'>";
echo " <img src='data:image/jpeg;base64,"
. base64_encode($imageData) . "' height='95' width='95'/>";
echo "</div>";
}
Solution 2:
if we assume that $row["image"]
is path to image, then you should change your code like below:
...
while($row= mysql_fetch_assoc($query)){
$imageData=$row["image"];
?>
<div align='left'>
<img src='<?php echo $imageData;?>' height='95' width='95'/>
</div>
<?php
}
...
I don't execute my code, I want show you only idea
Post a Comment for "How To Display Multiples Images From MySql"