亚洲免费在线视频-亚洲啊v-久久免费精品视频-国产精品va-看片地址-成人在线视频网

您的位置:首頁技術文章
文章詳情頁

vue使用exif獲取圖片經緯度的示例代碼

瀏覽:129日期:2022-10-20 09:05:16

我上一篇文章寫了怎么壓縮圖片和旋轉。這篇寫一下怎么看圖片的經緯度

注意!!!

只有原圖有大量的元數據信息。通過拍照軟件如:b612等,拍攝的照片是軟件處理過的,所以一定要使用原圖來擦查詢

下面貼以下代碼。

<template> <div> <input type='file' accept='image' @change='upload' /> <span>{{textData}}</span> </div></template><script>export default { data() { return { picValue: {}, headerImage: ’’, textData:’’ }; }, components: {}, methods: { upload(e) { console.log(e); let files = e.target.files || e.dataTransfer.files; if (!files.length) return; this.picValue = files[0]; this.imgPreview(this.picValue); }, imgPreview(file) { let self = this; let Orientation; //去獲取拍照時的信息,解決拍出來的照片旋轉問題 self.EXIF.getData(file, function() { Orientation = self.EXIF.getTag(this, ’Orientation’); }); // 看支持不支持FileReader if (!file || !window.FileReader) return; if (/^image/.test(file.type)) { // 創建一個reader let reader = new FileReader(); // 將圖片2將轉成 base64 格式 reader.readAsDataURL(file); // 讀取成功后的回調 reader.onloadend = function() { let result = this.result; let img = new Image(); img.src = result; self.postImg(file); }; } }, postImg(val) { //這里寫接口 let self = this; // document.getElementById(’upload’) // this.EXIF.getData(val, function(r) { let r = this.EXIF.getAllTags(val); const allMetaData = r; let direction; if (allMetaData.GPSImgDirection) { const directionArry = allMetaData.GPSImgDirection; // 方位角 direction = directionArry.numerator / directionArry.denominator; } let Longitude; if (allMetaData.GPSLongitude) { const LongitudeArry = allMetaData.GPSLongitude; const longLongitude = LongitudeArry[0].numerator / LongitudeArry[0].denominator + LongitudeArry[1].numerator / LongitudeArry[1].denominator / 60 + LongitudeArry[2].numerator / LongitudeArry[2].denominator / 3600; Longitude = longLongitude.toFixed(8); } let Latitude; if (allMetaData.GPSLatitude) { const LatitudeArry = allMetaData.GPSLatitude; const longLatitude = LatitudeArry[0].numerator / LatitudeArry[0].denominator + LatitudeArry[1].numerator / LatitudeArry[1].denominator / 60 + LatitudeArry[2].numerator / LatitudeArry[2].denominator / 3600; Latitude = longLatitude.toFixed(8); } self.textData = ’我是Longitude’ + Longitude + ’ ====== ’+'我是Latitude' + Latitude console.log(’我進來了’, direction, Longitude, Latitude); console.log(’allMetaData’, allMetaData); //接口 axios // }); } }};</script>

這個功能是下載的exif.js文件,也可以通過npm安裝依賴。不過都要掛在到原型鏈上。

以上就是vue使用exif獲取圖片經緯度的示例代碼的詳細內容,更多關于vue 獲取圖片經緯度的資料請關注好吧啦網其它相關文章!

標簽: Vue
相關文章:
主站蜘蛛池模板: 免费区欧美一级毛片精品 | 韩日一区二区 | 亚洲狠狠综合久久 | 国产美女自拍视频 | 女女同性一区二区三区四区 | bt天堂国产亚洲欧美在线 | 国产亚洲精品看片在线观看 | 在线私拍国产福利精品 | 日本三级香港三级人妇r | 99re66热这里只有精品免费观看 | 精品久久久影院 | 国产伦精品一区二区三区免费 | 97国产免费全部免费观看 | 在线成人a毛片免费播放 | 日韩欧美一区二区三区不卡视频 | 欧美高清免费精品国产自 | 国产综合在线播放 | 日本不卡免费高清视频 | 国产一区在线免费观看 | 风流慈禧一级毛片在线播放 | 欧美成人影院 | 艹美女视频 | 波多野结衣在线视频观看 | 国产看片视频 | 亚洲孕交 | 国产精品久久久精品三级 | 成免费网站 | 五月久久亚洲七七综合中文网 | 国产高清在线视频 | 美女网站免费观看视频 | 99视频在线精品 | 中国成人免费视频 | 久草视频在线观 | 国产日韩亚洲欧美 | 欧美曰批人成在线观看 | 国产天堂在线一区二区三区 | 亚洲国产欧美国产综合一区 | 中文在线视频观看 | 亚洲精品99久久久久中文字幕 | 国产成人久久777777 | 99久久亚洲 |