uni.chooseImage({
sizeType: ['original'],
sourceType: ['camera'],
success: function (res) {
console.log(JSON.stringify(res.tempFilePaths));
var allFiles = res.tempFilePaths;
var tmpimg = allFiles[0];
console.log(tmpimg)
//#ifdef APP-PLUS
plus.io.resolveLocalFileSystemURL(tmpimg, function(entry){
entry.file(function(file){
var reader = new plus.io.FileReader();
reader.onloadend = function (e) {
var base64=e.target.result
console.log(base64);
var name=tmpimg.substring(tmpimg.lastIndexOf('/') + 1);
var img={path:tmpimg,name:name,src:base64};
var EXIF=require('@/common/js/js_sdk/exif/exif.js');
EXIF.getData(img, function(){
console.log(EXIF.pretty(this));
console.log('AllTags:',EXIF.getAllTags(this)) // 此处打印的为选中图片的数据
console.log(EXIF.getTag(this, 'Orientation'));
var tagj=EXIF.getTag(this,'GPSLongitude');
var tagw=EXIF.getTag(this,'GPSLatitude');
if(tagj&&tagw) {
var longitude=tagj[0]+tagj[1]/60+tagj[2]/60/60;
var latitude=tagw[0]+tagw[1]/60+tagw[2]/60/60;
var lalinfo=this.name+":"+longitude+":"+latitude+",";
console.log(lalinfo);
uni.openLocation({latitude:latitude,longitude:longitude});
}
})
};
reader.readAsDataURL(file);
},function(e){
console.log("读写出现异常: " + e.message );
throw "Could not load image";
})
})
//#endif
}
2 个回复
8***@qq.com - 自由工作比上班赚的多
看这里 http://hhyang.cn/doc4/
2***@qq.com