title | description |
---|---|
EdgeCamera |
Take pictures with the device camera and automatically crop them. |
Based of IPDFCameraViewController
This plugin defines a global EdgeCamera
object, which provides an API for taking pictures and cropping them.
This requires cordova 5.0+
Currently installable via repo url directly ( unstable )
cordova plugin add https://github.com/brianmwadime/phonegap_edge_camera.git
- edgecamera
- .takePicture(successCallback, errorCallback, options)
- .onError :
function
- .onSuccess :
function
- .CameraOptions :
Object
Takes a photo using the camera, or retrieves a photo from the device's
image gallery. The image is passed to the success callback as a
Base64-encoded String
, or as the URI for the image file.
The camera.takePicture
function opens the device's default camera
application that allows users to snap pictures by default.
Once the user snaps the photo, it is cropped and the camera application closes and the application is restored.
The return value is sent to the cameraSuccess
callback function, in
one of the following formats, depending on the specified
cameraOptions
:
- A
String
containing the Base64-encoded photo image.
You can do whatever you want with the encoded image or URI, for example:
-
Render the image in an
<img>
tag, as in the example below -
Save the data locally (
LocalStorage
, Lawnchair, etc.) -
Post the data to a remote server
Supported Platforms
- iOS
Kind: static method of edgecamera
Param | Type | Description |
---|---|---|
successCallback | onSuccess |
|
errorCallback | onError |
|
options | CameraOptions |
CameraOptions |
Example
EdgeCamera.takePicture(cameraSuccess, cameraError, cameraOptions);