回声blob图像php

时间:2017-02-02 11:39:05

标签: php

嗨,我在这里寻找一些帮助,我想用“回声”显示图像,我不能学习一些PHP。 这是我的代码。

<?php

include('../../config/db.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];

$sql = "SELECT * FROM pedidos where p_id='$id'";
while($row = mysql_fetch_array($sql))
{   
  echo "ID:" .$row['p_id'] . "<br>";
  echo "ID:" .$row['p_portal'] . "<br>";
  echo "ID:" .$row['p_datacri'] . "<br>";
  echo "ID:" .$row['p_datapub'] . "<br>";
  echo "ID:" .$row['p_titulo'] . "<br>";
  echo "ID:" .$row['p_keywords'] . "<br>";
  echo "ID:" .$row['p_hashtags'] . "<br>";
  echo '<img src="data:image/jpeg;base64,'.base64_encode( $result['p_ImageData'] ).'"/>';
  echo "ID:" .$row['p_pedido'] . "<br>";
  echo "ID:" .$row['p_autor'] . "<br>";
  echo "ID:" .$row['p_nomeuti'] . "<br>";  

}
}
?>

Table fields

enter image description here

1 个答案:

答案 0 :(得分:1)

所以你有两个错误: -

一个$result需要$row

p_ImageData需要p_imageData

所以它应该是: -

echo '<img src="data:image/jpeg;base64,'.base64_encode( $row['p_imageData'] ).'"/>';