我使用cordova 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),但不能打开带有File uploader标签的相机:
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(字符串)中的图像细节丢失,而文件上传图像中的图像细节容易读取图像细节(GPS long lat)
请让我知道,帮助我,我花了一个星期但没有从data_URL获得任何exif图像细节,