从mysql php检索图像时不显示结果

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (79)

在进行查询时没有显示图像,并且在浏览器中检查图像时,会出现一些字母作为结果

图像blob

这是我的代码

<?php 
$con = new mysqli ('localhost', 'cualquiera', '123123','rier');
$datos = $con->query("SELECT * FROM fotos  ") ;?>
<?php  while ($user = $datos->fetch_assoc()){ ?>
<tr>  
<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['modelo'] ;?>
<?php echo $user['ubicacion'] ; ?></strong></a></div></td>
<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['anio'] ; ?> 
</strong></a></div></td>
<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['chasis'] ; ?> 
</strong></a></div></td>

<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['transmision'] 
; ?></strong></a></div></td>
<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['color'] ; ?> 
</strong></a></div></td>  
<td class="xl80"><div align="center" class="style84"><a 
href="./autos/304862/304862.htm"><strong><?php echo $user['estado'] ; ?> 
</strong></a></div></td>
<td class="xl80"><div align="center" class="style84"> <?  echo '<img 
src="data:image/jpeg;base64,'.base64_encode( $user['imagen'] ).'"/>'?>                                      
</div></td>
</tr>
<?} ?>

提问于

扫码关注云+社区

领取腾讯云代金券