javascript - display mp3 id3 tage image on web page -
i'm trying obtain mp3's id3 tag information server , gets album art displayed on front end.
to obtain tag information used external js library on git hub. , here code retrieve tag information , image information id3 tags:
function disp_image(tag){ var image = tag["tags"]["picture"]; var base64string=""; if(image){ for(var i=0;i<image.data.length;i++){ base64string += string.fromcharcode(image.data[i]); } var base64 = "data:"+image.format + ";base64,"+window.btoa(base64string) $("#album-pic")[0].src = base64; } else{ $("album-pic")[0].style.display="none"; } }
i embedded image src base64 format, think i'm having format converting problems not sure problem is.
Comments
Post a Comment