wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
var tempFilePaths = res.tempFilePaths;
console.log(tempFilePaths);
wx.request({
url: tempFilePaths[0],
method: 'GET',
responseType: 'arraybuffer',
success: function(res) {
var base64 = 'data:image/jpg;base64,' + wx.arrayBufferToBase64(res.data);
console.log(base64);
}
});
}
})
wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
var tempFilePaths = res.tempFilePaths[0];
console.log(tempFilePaths);
var base64 = 'data:image/jpg;base64,' + wx.getFileSystemManager().readFileSync(tempFilePaths, "base64");
console.log(base64);
}
})