MY PHP CODE IS BELOW echoed image shows only its thumbnail
<?php
if(isset($_SESSION['user_id'])){
$userid = $_SESSION['user_id'] ;
$query = "SELECT img FROM user where iduser='{$userid}' LIMIT 1 ";
$result_set = mysqli_query($connection,$query);
while($row = mysqli_fetch_assoc($result_set)){
echo $row['img'];
if(is_null($row['img'])){
echo '<img src="assets/images/fuser.png" class="img-responsive img-thumbnail" style="height:256px;width:256px">';
}else{
echo '<img src="assets/images/"'.$row['img'].'" class="img-responsive img-thumbnail" style="height:256px;width:256px">';
}
}
}
?>
My image shows like this https://imgur.com/a/uXcdytz
The html you're echoing is ill-formed:
echo '<img src="assets/images/"'.$row['img'].'" class="img-responsive img-thumbnail" style="height:256px;width:256px">';
For $row['img']
that's image1.jpg
, your code will echo this:
<img src="assets/images/"image1.jpg" class="img-responsive img-thumbnail" style="height:256px;width:256px">
Which has an additional unnecessary quote in the src
attribute, so the image src
destination won't exist, your echo should be (after removing the "
after images/
):
echo '<img src="assets/images/'.$row['img'].'" class="img-responsive img-thumbnail" style="height:256px;width:256px">';
Also make sure that your php file is in the folder assets/
.