in mongodb my image is saved as
image: BinData(0, 'QzpcZmFrZXBhdGhcV2hhdHNBcHAgSW1hZ2UgMjAyMi0xMi0wNCB40Ny4zMS5qcGc=')
I am trying to access this image in my frontend Reactjs like this
{userData.image ? <img src={
data:image;base64,${userData.image}} alt="User profile image" width="200" height="200" /> : <img src={'./Images/profile.png'} alt="Default image" width="200" height="200" /> }
but it is not showing this image
How can i access this decode this image back to its original form
2
Answers
This is how you can display the images in your React component:
It’s actually better to do it this way.