javascript - Why can't I preview after taking a photo with WeChat jssdk?
黄舟
黄舟 2017-05-19 10:35:02
0
1
649

When calling the WeChat interface chooseimg, in the successful callback function, according to WeChat, each ID in the local ID list of the selected photo is taken out and used as the src of the displayed image, but in fact all the IDs It has been returned, but after putting it in html, the picture cannot be displayed

wx.chooseImage({
  count: 1,
  sizeType: ['original', 'compressed'],
  sourceType: ['camera'],
  success: function (res) {
    var localId = res.localIds;
    $.each(res.localIds,function(i,n){
      $("#pic").append('<img src='+ n + '/>');
    })
}

The above is the code I wrote, but the picture cannot be found in which p of the pic

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
我想大声告诉你

It has been solved. It seems to be due to the latest browser of ios. I haven’t looked at the details. You need to use a getlocalimgdata API. In order to be compatible with Android and Apple, you also check whether the converted text in base64 format is correct. That’s it (this is my first self-question and answer, if there is anything unclear or wrong, please point it out)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!