0

While trying to retrieve blob values stored in database by using this way,I have problem.Please help me.

Blob value is stored in database in this way. 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);

And tried to retrieve in this way: Where I got stuck

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

Clicking of this image icon produce Image

Actual Image is Actual Image is

SM123
  • 25
  • 1
  • 11
  • 1
    Possible duplicate of [PHP display image BLOB from MySQL](https://stackoverflow.com/questions/20556773/php-display-image-blob-from-mysql) – zod Apr 11 '19 at 19:24

1 Answers1

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

Also, inserting values should be changed:

$criteria = [
    //...
    'image' => $temp,  // do not use single quotes
];
u_mulder
  • 54,101
  • 5
  • 48
  • 64