小程序
小游戏
企业微信
微信支付
扫描小程序码分享
- 当前 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)
}
})
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
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)
}
})
}
})
},
})
},
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)