如何从数据库中获取实际图像

How to fetch actual image from the database

我很难从数据库中获取图像。我只能获取图像的 ID,但实际图像文件不能。 这是我在 display.php 中尝试获取图像的代码。

$sql="Select * from tblcenter";
$result=mysqli_query($con,$sql);
$number=1;
while($row=mysqli_fetch_assoc($result)){
    $id=$row['id'];
    $img_id = $row['img_id']; 
    $name=$row['name'];
    $mobile=$row['mobile'];
    $email=$row['email'];
    $address=$row['address'];
    $table.='
    <tr>
      <td scope="row">'.$number.'</th>
      <td><img src = "data:uploads/;base64,'.base64_encode($row['img_id']).'"style="width: 100px; 
       height: 100px"></td>
      <td>'.$name.'</td>
      <td>'.$mobile.'</td>
      <td>'.$email.'</td>
      <td>'.$address.'</td>
      <td>
        <button class="btn btn-dark" onclick="GetDetails('.$id.')">Update</button>
        <button class="btn btn-danger" onclick="DeleteUser('.$id.')">Delete</button>
          </td>
        </tr>';
    $number++;
}

this is the result of my current code

this the database/table of image

$sql="Select t.*,i.img_name from tblcenter t JOIN images i ON t.img_id = i.id";
$result=mysqli_query($con,$sql);
$number=1;
while($row=mysqli_fetch_assoc($result)){
$id=$row['id'];
$img_name = $row['img_name']; 
$name=$row['name'];
$mobile=$row['mobile'];
$email=$row['email'];
$address=$row['address'];
$table.='
<tr>
  <td scope="row">'.$number.'</th>
  <td><img src = "/images/'. $row['img_name'] . '" style="width: 100px; 
   height: 100px"></td>