Converting an image to base64 in angular 2

后端 未结 7 523
醉话见心
醉话见心 2020-11-30 05:31

Converting an image to base64 in angular 2, image is uploaded from local . Current am using fileLoadedEvent.target.result. The problem is, when I send this base64 string thr

相关标签:
7条回答
  • 2020-11-30 05:58

    Have you tried using btoa or Crypto.js to encode the image to base64 ?

    link to cryptojs - https://code.google.com/archive/p/crypto-js/

    var imgSrcData = window.btoa(fileLoadedEvent.target.result);

    or var imgSrcData = CryptoJS.enc.Base64.stringify(fileLoadedEvent.target.result);

    0 讨论(0)
提交回复
热议问题