Git Product home page Git Product logo

cordova-multi-plugin's Introduction

Description

Phonegap plugin which allows the caller to customise a camera preview, including a custom button and overlaying a image.

Using the plugin

  • Add the plugin ID and version to the config.xml.
<gap:plugin name="com.overlay.plugins.camera" />
  • Add custom images for the capture button and borders to your project. The image locations under the Phonegap www directory cannot currently be modified.
Path Description
www/img/cameraoverlay/overlay.png The top left border image
www/img/cameraoverlay/cancel_button.png The default image for the cancel button
www/img/cameraoverlay/capture_button.png The default image for the capture button
www/img/cameraoverlay/capture_button_pressed.png The image for the capture button when tapped
  • Call the plugin from JavaScript. The API is similiar to the Phonegap provided API but currently lacking some of its features.
navigator.overlayCamera.getPicture(filename, success, failure, [ options ]);
Parameter Description
filename The filename to use for the captured image - the file will be stored in the local application cache. Note that the plugin only returns images in the JPG format.
success A callback which will be executed on successful capture with the image data as the first parameter.
error A callback which will be executed if the capture fails with an error message as the first parameter.
options An optional object specifying capture options.

Capture options

Option Default Value Description
quality 100 The compression level to use when saving the image - a value between 1 and 100, 100 meaning no reduction in quality.
targetWidth -1 The target width of the scaled image, -1 to disable scaling.
targetHeight -1 The target height of the scaled image, -1 to disable scaling.

Image scaling

Setting both targetWidth and targetHeight to -1 will disable image scaling. Setting both values to positive integers will scale the image to that exact size which may result in distortion. If the aspect ratio should be respected, supply only the targetWidth or targetHeight and the other will be set based on the aspect ratio.

Example

navigator.overlayCamera.getPicture(filename, function success(imageData) {
    console.log(imageData);
}, function failure(error) {
    alert(error);
}, {
    quality: 80,
    targetWidth: 120,
    targetHeight: 120
});

cordova-multi-plugin's People

Contributors

mouryaamit avatar

Watchers

James Cloos 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.