How to retrive image which store on database in BLOB form ??

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

How to retrive image which store on database in BLOB form ??

You just used the same query to fetch the data from the database.

Do you have a database set-up?

Do you have query that you are working on? If so, post you query.

It's not as complicate as you think.

Member Avatar for diafol

for direct output...(for a jpeg - but could be imagegif, imagepng etc)

$img = imagecreatefromstring($dbData); 
ob_start();
imagejpeg($img, null);
$out = ob_get_contents();
ob_end_clean();
$output = "<img src="data:image/jpg;base64,' .  base64_encode($out)  . '" />';
//...
echo $output;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.