How to transfer WeChat Mini Programs's picture to base64
In this article, the editor introduces in detail the "WeChat Mini Programs picture pull how to base64", the content is detailed, the steps are clear, and the details are handled properly. I hope this "WeChat Mini Programs picture pull how to base64" article can help you solve your doubts.
Usage
Js file
Let $this = this;request ({url:' https://cache.yisu.com/upload/ask_collection/20210725/111/131488.jpg', method:'GET', responseType: 'arraybuffer', success:function (res) {let base64 = wx.arrayBufferToBase64 (res); $this.data.userImageBase64 = _' data:image/jpg;base64,' + base64;;}})
Wxml file
PS: the easiest way to convert Mini Program's local pictures to base64
Wx.chooseImage: get the image address
Wx.getFileSystemManager: create a file management class
ReadFileSync: read local files and get base64 directly
Wx.chooseImage ({success: function (res) {console.log (wx.getFileSystemManager (). ReadFileSync (res.tempFilePaths [0], "base64"))},}) here, the article "how to transfer the picture of WeChat Mini Programs to base64" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about the related articles, Welcome to the industry information channel.