okland / camera-ui

Meteor package for taking photos with user interface, one function call on desktop and mobile. Allows to choose between camera to photoLibrary on mobile.
28 stars 12 forks source link

Meteor Camera UI Package

Add it to your Meteor app with meteor add okland:camera-ui. This package is mobile UI expanded version of mdg:camera package.

There are only four methods in this package :

MeteorCameraUI.getPicture([options], callback)

Prompt the user to take a photo with their device and get the picture as a Data URI in JPEG format. On mobile show actionsheet that asks the user whether he wants to take a picture or use image gallery. This function expand the Meteor.Camera.getPicture so it allows to specify different options per ios, android or browser.

options

options is an optional argument that is an Object with the following possible keys:

callback(error, data)

callback is a required argument that is a function that takes two arguments:

MeteorCameraUI.getPictureNoUI([options], callback)

Just to regular take photo function of MeteorCamera. Prompt the user to take a photo with their device and get the picture as a Data URI in JPEG format.

options

options is an optional argument that is an Object with the following possible keys:

callback(error, data)

callback is a required argument that is a function that takes two arguments:

MeteorCameraUI.dataURIToBlob(dataURI)

An helper function to convert the dataURI of the image received from camera to blob with specific contentType. Commonly used on cordova apps in order to upload the image that was taken.

MeteorCameraUI.b64toBlob(b64Data, contentType, sliceSize)

An helper function to convert base64 data to blob with specific contentType. Commonly used on cordova apps in order to upload the image that was taken.

Please note : If you take the a base64-encoded data URI for the image taken by the camera, you should give this function only the part that follows the ','