微信版本号:8.0.50
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
sizeType: ['compressed'],
camera: 'back',
success: async function(res) {
console.log(res.tempFiles[0].tempFilePath)
const tempFilePath = res.tempFiles[0].tempFilePath;
let image = await getImgInfo(tempFilePath)
let compressPic= await contractionImage(image,'imgCanvas')
console.log(compressPic,'compressPic');
const fs = wx.getFileSystemManager();
const fileContent = fs.readFileSync(compressPic.tempFilePath, 'base64');
console.log(fileContent,'fileContent');
const base64 = fileContent; // 注意:这里假设图片是png格式,根据实际情况可能需要修改
await that.parseBase64(base64)
},
fail(err) {
// 接口调用失败的回调函数
console.error(err, '报错');
}
})
具体什么问题?