Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to transfer WeChat Mini Programs's picture to base64

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 246

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report