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

Recommended Answers

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;
Jump to Post

All 2 Replies

Member Avatar

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 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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.