Skip to content

An iOS and Android camera roll plugin for Cordova/PhoneGap/Ionic

License

Notifications You must be signed in to change notification settings

bamlab/cordova-camera-roll

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova Camera Roll

The Cordova Camera Roll plugin makes it easy to read from the camera roll.

Cordova comes with some camera features such as navigator.camera.getPicture. The problem is you have no control over the experience beyond that. On iOS, for example, a modal slides in that lets you choose a picture.

With this plugin you can get a list of all photos and do whatever you want with them after that.

Installation

cordova plugin add https://github.com/bamlab/cordova-camera-roll.git

Usage

CameraRoll.getPhotos(function(photo) {
  // `photo` is an object with `path`, `date`,
  // `thumbnailPath` (android only) and `orientation` (in degrees) (android only).
  //
  // On iOS, paths are prefixed asset-library://
  // So if you are using Angular and ng-src, make sure to whitelist this URL scheme.
  //
  // You can use the paths directly in an img src or as a background-image in CSS.
  //
  // This callback will be called for each photo in the roll. It's async, yo!
  //
  // When the last photo is reached, the callback is called one last time with an empty object.
}, function(err) {
  // Something bad happened :O
}, {
  count: 12, // Optional, will only return the last N photos.
});

// (iOS only) Quickly save a base-64 encoded data uri to the camera roll.
CameraRoll.saveToCameraRoll(base64String, function() {
  // File saved
}, function(err) {
  // Something bad happened :O
});

About this module

Originally created by Max Lynch @maxlynch, with Android support by Jeremy Bouillanne johnnyoin.

Tested on Cordova android 5.1.1 and Cordova ios 4.1.1.

TODO

  • Change the interface to have a single success callback called once, with the full list of photos.

About

An iOS and Android camera roll plugin for Cordova/PhoneGap/Ionic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 52.0%
  • Objective-C 43.7%
  • JavaScript 4.3%