Using PhoneGap, How to get base64 image data of the photo chosen from photo library in iPhone

前端 未结 6 1525
无人及你
无人及你 2021-01-12 08:58

Using PhoneGap(Cordova), Am trying to get base64 image data of the photo chosen from the photo library.

I could do that.. when the photo is captured from camera, Wi

6条回答
  •  余生分开走
    2021-01-12 09:41

    You just need to tell it to pick from the photo library:

    navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
        destinationType: Camera.DestinationType.DATA_URL,
        sourceType : Camera.PictureSourceType.PHOTOLIBRARY
    }); 
    

    Please be aware that loading a large base 64 encoded image may just cause and out of memory error in your app. Wherever possible use the FILE_URI to get your photo.

提交回复
热议问题