Display raw binary data of an image

Viewed 538

I'm trying to convert the raw binary data of an image and then display it.

Steps to approach to the problem,

1. I have saved the raw binary data of images in my database.

Preview:

enter image description here

2. Fetch & Convert the data into a blob and then into a blob url.

const image = URL.createObjectURL(new Blob([ project.image ], { type: 'image/jpg' }))

where project.image contains the raw binary data.

3. Add the url to the img tag.

enter image description here

4. Problem: Not displaying the image as expected.

Preview:

enter image description here

I have spent many hours not knowing what is wrong here. Any help would be highly appreciated. Thanks!

0 Answers
Related