【问题标题】:How to get a picture from the photo library with PhoneGap on Android如何在 Android 上使用 PhoneGap 从照片库中获取图片
【发布时间】:2016-03-11 16:48:11
【问题描述】:

我正在使用以下代码:

        navigator.camera.getPicture(successFunc, errorFunc,{
            quality: 50,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
        }); 

但是没有显示照片库。相反,相机被激活。我使用的是 Android 5。

【问题讨论】:

  • PhoneGap/Cordova 的哪个版本?什么版本的相机插件?我在 Cordova Android 5.1.0 和 Camera Plugin 2.1.0 上运行了您的代码,它在我的 Android 5.1 设备上运行良好。

标签: javascript android cordova


【解决方案1】:

感谢您的回答。 更新平台解决了这个问题

【讨论】:

    【解决方案2】:

    这在所有运行 android 5+ 的设备上都可以正常工作:

         navigator.camera.getPicture(onProfilePicURISuccess, onFail, {
            quality: 100,//
            //targetWidth : 512,
            //targetHeight : 512,
            allowEdit : true,
            destinationType : destinationType.DATA_URL,
            correctOrientation : true,
            sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY,
            saveToPhotoAlbum: false
        });
    

    【讨论】:

      猜你喜欢
      • 2012-06-26
      • 2012-05-30
      • 1970-01-01
      • 2014-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多