I have a mobile app, which I want to know and do is:
I have a modal that when I open I want the photos that I have on the device to appear (in this case on the camera roll) and but show on a div
that I already have. How can I do this ?
I have a mobile app, which I want to know and do is:
I have a modal that when I open I want the photos that I have on the device to appear (in this case on the camera roll) and but show on a div
that I already have. How can I do this ?
You can access the photo library and choose 1 photo with the phonegap camera plugin, but do not list all the photos
The code below opens the mobile library and allows you to choose a photo, returning its location:
var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail, { destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY)
});
Well I had trouble trying to open the gallery or use the cordova plugin camera, the problem was not related to the camera plugin, but with the compat plugin, using recommendations I found, forcing it to be removed and installing version 1.1 .0.
To avoid problems, I also removed the plugin from the camera, and added again.
cordova plugin rm cordova-plugin-camera --save
cordova plugin add cordova-plugin-camera --save
cordova plugin remove cordova-plugin-compat --force --
save
cordova plugin add [email protected] --save
Using the method presented by @mauroneto, worked perfectly.
var cameraPopoverHandle = navigator.camera.getPicture(
function(onSuccess){
console.log(onSuccess);
},
function(onFail){
console.error(onFail);
},
{
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
popoverOptions: new CameraPopoverOptions(
300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY
)
}
);