Giter VIP home page Giter VIP logo

angularjs-camera's Introduction

angularjs-camera

HTML5 camera directive for angularjs based mobile applications.

Features

  • Uses <input type="file" capture="camera"> so the camera of the mobile devices could be used without any need for intermediate APIs like cordova. In non-mobile devices it opens file selection dialog much like a regular file upload.
  • The captured image data is returned base64 encoded, which can be used in the src attribute of <img> tag, or be sent to the server.
  • The photo is resized to a manageable size in-browser by using <canvas> element to avoid possible memory issues.
  • EXIF data is copied from the original photo to the resized image so the orientation of the photo won't be broken and other data like GPS info etc. are not lost.

Usage

Add <camera on-select="getPhoto(photo)"></camera> to your html and implement the getPhoto function in the controller, which expects a promise for the base64 encoded image data. You will need to base64 decode the data in the server.

See index.html and app.js for an example.

Notes

  • This is not a production ready library, don't expect much...
  • Tested only on webkit and ionicframework, however should work with other modern browsers too.

Credits

  • ExifRestorer by Martin Prantl is used to copy the exif data.

## TODO

  • EXIF process is a little slow, reading the first 128kb of the image should be enough to parse the exif data.
  • Use Web Workers for better responsibility and performance
  • Customization

angularjs-camera's People

Contributors

ozanhazer avatar

Watchers

 avatar

Forkers

augustofaria

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.