无法从未加载图像的数据库中检索blob文件

问题描述 投票:0回答:1

在尝试使用这种方式检索存储在数据库中的blob值时,我有问题。请帮助我。

Blob值以这种方式存储在数据库中。 Database

 $criteria = [
            'lotItemNumber' => '',
            'artistName' =>$_POST['artistName'],
            'classification' =>$_POST['classification'],
            'producedYear' =>$_POST['producedYear'],
            'auctionDate' =>$_POST['auctionDate'],
            'textualDescription' =>$_POST['textualDescription'],
            'estimatedPrice' =>$_POST['estimatedPrice'],
            'image' =>'$temp'



              ];

$stmt = $stmt->insert($criteria);

并试图以这种方式检索:Where I got stuck

echo'<imgsrc="data:image/jpeg;base64,'.base64_encode($row['image']).'width="250" height="250">';

单击此图像图标可生成Image

实际图像是Actual Image is

php
1个回答
0
投票
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image']).'" width="250" height="250">';
          ^ space here                                                 ^ close quote and add space

此外,应更改插入值:

$criteria = [
    //...
    'image' => $temp,  // do not use single quotes
];
© www.soinside.com 2019 - 2024. All rights reserved.