On the problem of WeChat Mini Programs's customized sharing with pictures in base64 format

the project needs to get a base64 image from the h5 page embedded in the mini program webview, and use this picture as a picture of the sharing window when sharing. The picture is dynamically generated by the canvas of h5. Now the base64 can be fully passed into Mini Program. Here is the code

onShareAppMessage: function (res) {

if (res.from === "button"){
  
}
if(this.data.picUrl !== "") {
  console.log(this.data.picUrl)
  return {
    title: this.data.goodsName,
    path: "/pages/fitview/fitview",
    imageUrl: this.data.picUrl    // picUrlbase64
  }
}
base64:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAADm452EISNvX2rmSTqXUDj29d4llSkpJJdPJ2i

 imageUrl urlbase64base64wxmlimagesrcbase64
url



      // 
      let imageUrl = 'base64';
      // console.log(imageUrl)
      wx.getImageInfo({
        src: imageUrl,
        success: (res) => {
          // console.log(res.path)
          this.setData({
            imageUrl: res.path
          })

        }
      })
 
Menu