Hi,
I am trying to display image from database. I have converted the database image into base 64 format. I am using javascript for the conversion. But its not an image format. My code is as follows:
var che = btoa(data.d.ItemImage1);
$('#imgUpload').attr('src', "data:image/png;base64," + che);
On alerting this, the format will be as follows, but it cannot show an image.
MTAwLDk3LDExNiw5Nyw1OCwxMDUsMTA5LDk3LDEwMywxMDEsNDcsMTA2LDExMiwxMDEsMTAzLDU5LDk4LDk3LDExNSwxMDEsNTQsNTIsNDQsNDcsNTcsMTA2LDQ3LDUyLDY1LDY1LDgxLDgzLDEwNyw5MCw3NCw4MiwxMDMsNjUsNjYsNjUsMTAzLDY5LDY1LDg5LDY1LDY2LDEwMyw2NSw2NSw2OCw0Nyw1NSwxMDMsNjUsNzksODEsODcsODIsMTE4LDg5LDEwOSw4NSw2NSw5MCw2NSw2NSw2NSw2NSw2NSw2NSw2Niw0Nyw0Myw2OSw4Myw2Nyw2OSw4Niw1Miw5Nyw4Nyw4OSw2NSw2NSw2OSw0OSw3OCw2NSw2NywxMTEsNjUsNjUsNjUsNjUsNzMsNjUsNjUsOTksNjYsNzcsMTAzLDY1LDY3LDY1LDY1LDY1LDY1LDcwLDY1LDY1LDY1LDY1LDcxLDczLDY2LDc5LDExOSw2NSw2Nyw2NSw2NSw2NSw2NSw2NiwxMTksNjUsNjUsNjUsNzIsOTAsNzIsODIsMTAzLDY1LDY4LDY1LDY1LDY1LDY1LDY1LDgxLDY1LDY5LDY1LDY1LDY2LDcyLDgzLDgxLDY1LDY4LDY1LDY1LDY1LDY1LDY1LDgxLDY1LDQ3LDY1LDY1LDY3LDk5LDExMCw4MSw2NSw2Niw2NSw2NSw2NSw2NSw2OCwxMDMsNjUsNjUsNjUsNjUsNjgsMTEzLDcyLDY1LDY1LDcyLDY1LDY1LDY1LDcyLDk4LDEwMyw2NSw2NSw2NSw2NSw2Nyw3Miw5Nyw4MSw2NSw2OSw2NSw2NSw2NSw2NSw2NSw4MSw2NSw2NSw2NSw3Miw0OCw2NSw2NSw2NSw2OCwxMTAsN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