getbase64FromImage(path) {
plus.io.resolveLocalFileSystemURL(path, function(entry) {
// 可通过entry对象操作test.html文件
entry.file(function(file) {
var fileReader = new plus.io.FileReader();
alert("getFile:" + JSON.stringify(file));
fileReader.readAsText(file, 'utf-8');
fileReader.onloadend = function(evt) {
alert("11" + evt);
alert("evt.target" + evt.target);
alert(evt.target.result);
}
alert(file.size + '--' + file.name);
});
}, function(e) {
alert("Resolve file URL failed: " + e.message);
});
},
getPhoto() {
var that = this
uni.chooseImage({
count: 1,
complete() {
},
success: function(res) {
var imagePath = JSON.stringify(res.tempFilePaths)
console.log(imagePath)
that.getbase64FromImage(imagePath)
}
})
},
0 个回复