从本地选择图片无法获得本地路径,一直显示临时路径
发布于 5 年前 作者 chao04 11425 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
  • 预期表现

获取图片本地路径

  • 复现路径

获取图片本地路径

  • 提供一个最简复现 Demo

获取图片本地路径

2 回复

choice1: function(e) {

var self = this;

wx.chooseImage({

count: 1,

sourceType: [‘album’, ‘camera’],

sizeType: [‘original’, ‘compressed’],

success: function(res) {

var re=res;

wx.getImageInfo({

src: res.tempFilePaths[0],

success(res) {

console.log(res.path)

wx.request({

url: https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.9c456c2bbbcfdaa0cd48800bf03ae15d.2592000.1548574107.282335-15294908,

data: {

// url: self.utf16to8(res.path)

url: self.utf16to8(https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=092fd68637292df588c3aa158c305ce2/9345d688d43f879439035b87df1b0ef41ad53a9e.jpg)

},

header: {

‘content-type’: ‘application/x-www-form-urlencoded’

},

method: ‘post’,

success(re) {

console.log(re)

}

})

}

})

},

})

},

回到顶部