Search code examples
javascriptcordovameteorcordova-plugins

Access Photos of iOS Photos app using Meteor.js and Cordova


How can you select a photo from the Photos iOS app?

With mdg:camera installed, I only managed to get photos by taking them using the iPhone's camera. How can we select an existing photo from the Photos app?

var cameraOptions = {
    width: 800,
    height: 600
};

MeteorCamera.getPicture(cameraOptions, function (error, data) {
    console.log('photo: ', data)
});

Solution

  • Just published a post regarding this...

    Basically all you have to do is add sourceType to your cameraOptions, like so:

    var cameraOptions = {
      width: 800,
      height: 600,
      sourceType: Camera.PictureSourceType.PHOTOLIBRARY
    };
    

    **Note: ** this will only work when using Cordova.

    Original Post: http://differential.com/blog/access-the-photo-library-in-your-meteor-cordova-app

    Demo Repo: https://github.com/spencercarli/meteor-cordova-photolibrary