科尔多瓦3.6:我怎么能提取从Android的照片库GPS Exif数据中? [英] Cordova 3.6: how can I extract GPS Exif data from photo library in Android?

查看:188
本文介绍了科尔多瓦3.6:我怎么能提取从Android的照片库GPS Exif数据中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展与科尔多瓦与3.6.x的一个Angularjs应用。一切似乎除了事实上,我不能提取从照片库拍摄的图像的EXIF DATAS日期和地点,以做工精细。

I'm developing an app with Cordova 3.6.x with Angularjs. Everything seems to work fine except the fact I can't extract date and location from the exif datas of an image taken from the photo library.

我的目标设备的是Android 4 +

My target device is Android 4+

因为现在我的测试:
- https://github.com/lorinbeer/cordova-exif-utility (无机器人支持:()
- https://github.com/guilhermefarias/cordova-exif (返回这样的错误而processMessage失败:错误:类型错误:无法调用未定义和processMessage而法'的toString'失败:消息:S01 File1189144150)
- https://github.com/kamilersz/cordova-plugin-exif (couldn'不懂它是如何工作)

Since now I tested: - https://github.com/lorinbeer/cordova-exif-utility ( no android support :( ) - https://github.com/guilhermefarias/cordova-exif (returns errors such "processMessage failed: Error: TypeError: Cannot call method 'toString' of undefined" and "processMessage failed: Message: S01 File1189144150") - https://github.com/kamilersz/cordova-plugin-exif (couldn't understand how it works)

在网上,我读了科尔多瓦的图像返回前去除所有的EXIF DATAS。是不是真的不可能得到那些DATAS?

On the net I read that Cordova strips all the exif datas before returning the image. Is it really impossible to get those datas?

能否请你帮我找出如何解决这个问题?

Can you please help me figure out how to solve this issue?

更新

我用角一起ngCordova,UI路由器和 https://github.com/guilhermefarias/cordova- EXIF 。所以,我要带UI路由器的决心的功能,有优势:

I use Angular alongside ngCordova, ui-router and https://github.com/guilhermefarias/cordova-exif. So I'm taking advantage of the "resolve" feature of ui-router that has:

resolve: {
    picture: ['$cordovaCamera', function($cordovaCamera) {
        var options = { 
            quality : 75,
            destinationType : navigator.camera.DestinationType.FILE_URI,
            sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
            allowEdit : false,
            correctOrientation: true,
            encodingType: Camera.EncodingType.JPEG,
            saveToPhotoAlbum: false
        };
        return $cordovaCamera.getPicture(options); //TODO: we need to handle errors
    }]
}

然后相应的控制器内我有

Then inside the corresponding controller I have

myApp.controller('UploadController',[
      '$范围',
      '图片',
      功能($范围,图片){

myApp.controller('UploadController', [ '$scope', 'picture', function( $scope, picture ) {

    //Picture
    $scope.snapShot = picture;

    CordovaExif.readData(picture, function(exifObject) {
      console.log(exifObject);
    });

不过,我得到以下错误
而processMessage失败:错误:类型错误:无法调用未定义的方法'的toString
而processMessage失败:堆栈:类型错误:无法调用未定义的方法'的toString
其次是堆栈跟踪和一个巨大的字符串,我肯定是的base64即使它不与任何的base64图像去codeR我试着在网上...

But I get the following error processMessage failed: Error: TypeError: Cannot call method 'toString' of undefined processMessage failed: Stack: TypeError: Cannot call method 'toString' of undefined Followed by the stacktrace and an enormous string that I'm quite sure is base64 even if it doesn't work with any base64 to image decoder I tried online...

推荐答案

您是对的至少在两个插件:


  • lorinbeer的科尔多瓦的Exif公用没有Android的支持

  • kamilersz'科尔多瓦 - 插件,EXIF 只是有一些设定的Exif元数据,并从设备获取的Wi-Fi信息的API。

  • lorinbeer's Cordova Exif Utility has no Android support
  • kamilersz' cordova-plugin-exif only has API for setting some Exif meta data and for getting Wi-Fi information from device.

但在科尔多瓦的Exif由guilhermefarias 似乎真的有前途,如果你表现出你试图在code,我也许能帮助你。当然这不是不可能得到的Exif,因为它是实际的文件的一部分。这仅仅是科尔多瓦的默认相机插件从图库中选择图像时失去的Exif。这似乎是真的做得很好(基于code我读)和记录。

But the Cordova Exif by guilhermefarias seems really promising and if you show the code you were trying, I might be able to help you. And of course it isn't impossible to get the Exif as it is part of the actual file. It is just the Cordova's default camera plugin that loses the Exif when selecting image from gallery. This seems to be really well done (based on code I read) and documented.

再有也只是读取图像作为二进制数据和应用类似 Exif.js <可能性/ A>读取的Exif。请参见这个答案就如何做到这一点用户理查德·尼科尔斯的。

Then there is also the possibility to just read the image as binary data and apply something like Exif.js to read the Exif. See this answer by user Richard Nichols on how to do this.

这篇关于科尔多瓦3.6:我怎么能提取从Android的照片库GPS Exif数据中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆