I have this function:
//The img_src is a source of an image
function myid_templates_editor_create_image(img_src, w, h){
console.log('image source : ' + img_src);
var body = document.querySelector('body');
var image = document.createElement('image');
image.id = 'myid_templates_editor_image';
image.src = img_src;
body.appendChild(image);
}
After the function is invoked, it successfully creates an image element and append it to the body but the image doesnt show. Why? img_src has the following value:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAYAAAA+s9J6AAAACXBIW…AkBAAAJAQAkBAAAJAQAEBCAABAQgAACQEAAAkBoAr47wDsSs6PZMN9tgAAAABJRU5ErkJggg==
IW…Ak- looks like a truncated stringimg_srcpassed in is not the url to an image but the image itself!img_srcvalue over here, but it turns up as inavalid/empty image. CAn you make sure that the argumentimg_srcvalue is a valid base64 encoded image value. I also think that value is a bit small. Normally encoded values should have huge # of chanracters