Code Monkey home page Code Monkey logo

camera's Introduction

Meteor Camera Package

Add it to your Meteor app with meteor add mikkelking:camera. The api is super simple - there is only one function to call. This is based on mdg:camera, with improvements to keep the image inside the dialog box, and to allow portrait mode without stretching or clipping the image.

MeteorCamera.getPicture([options], callback)

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 is automatic, depending on orientation (landscape/portrait)
  • magnification A multiplier which controls the size of the image - 2.286 (the default) gives you a picture size of 640x480, set to 1 gives you 280x210
  • 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.

Warning: In the iOS simulator, the device camera is not accessible so you will get an error that says "source type 1 not available." I'm working on a fallback for iOS that will use the photo library when the camera is not available, but for now just test in your web browser, a physical device, or the Android simulator.

camera's People

Contributors

mikkelking avatar

Watchers

 avatar

Forkers

theavijitsarkar

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.