我已经使用科尔多瓦 phonegap api 打开相机
$scope.capturePhoto = function () {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 50,
destinationType: navigator.camera.DestinationType.DATA_URL, sourceType: 1});
}
$scope.capturePhotoEdit = function () {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 20, allowEdit: true,
destinationType: navigator.camera.DestinationType.DATA_URL, sourceType: 1});
}
$scope.getPhoto = function () {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 50,
destinationType: navigator.camera.DestinationType.DATA_URL, sourceType: 0});
}
$scope.getPhotoAlbum = function () {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 50,
destinationType: navigator.camera.DestinationType.DATA_URL, sourceType: 2});
}
onFail = function (message) {
$window.alert(message);
}
在 DATA_URL 长字符串(如 base64)中,但 C# 中的 exif 未读取图像详细信息
如果我已经使用文件上传并转换为 base64,那么在 C# 中轻松获取 Exif 详细信息(GPS Long Lat),但不打开带有文件上传器标签的相机:
function readImage(input) {
console.log(input);
if ( input.files && input.files[0] ) {
var FR= new FileReader();
FR.onload = function(e) {
// $('#img').attr( "src", e.target.result );
$('#base').text( e.target.result );
};
FR.readAsDataURL( input.files[0] );
}
}
$("#asd").change(function(){
readImage( this );
});
在 c# 代码中阅读 Exif 详细信息是:
using ExifLibrary;
byte[] data = Convert.FromBase64String(model.imagebase64);
string file = model.workId + "_" + SnapName + ".Jpeg";
string liveserverpath = ConfigurationManager.AppSettings["MyFileLocation"].ToString();
liveserverpath = liveserverpath + file;
var exif = ExifFile.Read(liveserverpath);
try
{
newmodel.P_Latitude = (exif.Properties[ExifTag.GPSLatitude]).ToString();
newmodel.P_Longitude = (exif.Properties[ExifTag.GPSLongitude]).ToString();
newmodel.Snap_Status = "Valid";
}
我的问题是:为什么 Data_URL(string) 和文件上传图像到 base64 中缺少图像细节很容易读取图像细节(GPS long lat)
请让我知道,帮帮我,我在那花了一周时间,但没有从 data_URL 获得任何 exif 图像详细信息,