How to display image from mysql BLOB data type using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Joeldcruz
Forum Newbie
Posts: 6
Joined: Thu Nov 30, 2017 10:18 pm

How to display image from mysql BLOB data type using PHP

Post by Joeldcruz »

Hi

I am using Bootstrap css.
I have an issue to display image with data type BLOB, Really I don't know how to do this.

Pls advise me how to do this.


Thanks!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to display image from mysql BLOB data type using PHP

Post by requinix »

Make a script that queries the database for the BLOB data and for the type of image data it is, which you need to be storing. Then

Code: Select all

header("Content-Type: " . $image_type_from_database); // image type is like image/png or image/jpeg
echo $blob_data_from_database;
Post Reply