Skip to content
Advertisement

Converting BLOB, stored on a database, to an image on an HTML website

This is my first question.

I am having users upload their own image to a database. That image is stored as a BLOB.

I was able to do this successfully. I am using MySQL for the database.

The part I am having trouble with is displaying that BLOB as an image on the website when its called upon.

Right now only the Binary data, lots of weird symbols are being displayed. I think its a problem with the HTTP header. Right now its in :

JavaScript

I’ve tried:

JavaScript

I am using Python to connect with the database and write the HTML.

Edit: Code:

JavaScript

Advertisement

Answer

image is stored in database in binary format so once it comes to server using decode function to get it back to image

JavaScript

this will convert your blob to image

User contributions licensed under: CC BY-SA
11 People found this is helpful
Advertisement