Convert gif to Base64 String Using JavaScript
let xhRequest = new XMLHttpRequest(); xhRequest.onload = function () { let reader = new FileReader(); reader.onloadend = function () { callback(reader.result); } reader.readAsDataURL(xhRequest.response); }; xhRequest.open('GET', url); xhRequest.responseType = 'blob'; xhRequest.send();
参考:https://www.w3docs.com/snippets/javascript/how-to-convert-the-image-into-a-base64-string-using-javascript.html
此随笔乃本人学习工作记录,如有疑问欢迎在下面评论,转载请标明出处。
如果对您有帮助请动动鼠标右下方给我来个赞,您的支持是我最大的动力。