Giter VIP home page Giter VIP logo

camera-ui's Introduction

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:

  • width An integer that specifies the minimum width of the returned photo.

  • height An integer that specifies the minimum height of the returned photo.

  • quality A number from 0 to 100 specifying the desired quality of JPEG encoding.

  • iosOptions An Object - Special options only for ios {width:Int, height:Int, quality: ...}

  • androidOptions An Object - Special options only for android {width:Int, height:Int, quality: ...}

  • browserOptions An Object - Special options only for browser {width:Int, height:Int, quality: ...}

  • buttonTexts An Object - Allow to override the actionsheet button texts {cancel:String, takeImage:String, imageLibrary:String}

callback(error, data)

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

  • error A Meteor.Error with a platform-specific error message.
  • data A base64-encoded data URI for the image taken by the camera. This parameter can be used directly in the 'src' attribute of an image tag.

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:

  • width An integer that specifies the minimum width of the returned photo.
  • height An integer that specifies the minimum height of the returned photo.
  • quality A number from 0 to 100 specifying the desired quality of JPEG encoding.

callback(error, data)

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

  • error A Meteor.Error with a platform-specific error message.
  • data A base64-encoded data URI for the image taken by the camera. This parameter can be used directly in the 'src' attribute of an image tag.

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 ','

camera-ui's People

Contributors

okland avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.