Is there another way to put image from MySQL to html other than echoing it like this:
echo "<img src='images/" . $row['event_image'] . "' height='200' width='320' class=responsivez> ";
Im trying to put the image path onto the html tag. The getImage.php displays my image path but when called on the next page the image doesnt display. Am i missing some important syntax?
<img src="images/getImage.php?" width="175" height="200" />
getImage.php
<?php
$con=mysqli_connect("localhost","root","","blast");
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
$state='Johor';
$result=mysqli_query($con,"SELECT * from blast_events where
event_state='$state'");
if (!$result) {
die ('SQL Error: ' . mysqli_error($con));
}
else{
}
$row=mysqli_fetch_array($result);
echo $row["event_image"];
?>
Try to Output the image instead of just a path:
header('Content-Type:image/jpeg');
readfile($row["event_image"]); // make sure the path is valid not only filename.
// echo $row["event_image"];