Camera

Improve this doc

$ ionic plugin add cordova-plugin-camera

Repo: https://github.com/apache/cordova-plugin-camera

Take a photo or capture video.

Requires ionic-native and the Cordova plugin: cordova-plugin-camera. For more info, please see the Cordova Camera Plugin Docs.

Supported platforms

Usage

import {Camera} from 'ionic-native';

Camera.getPicture(options).then((imageData) => {
 // imageData is either a base64 encoded string or a file URI
 // If it's base64:
 let base64Image = "data:image/jpeg;base64," + imageData;
}, (err) => {
});

Static Methods

getPicture(options)

Take a picture or video, or load one from the library.

Param Type Details
options CameraOptions

Returns: Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.

cleanup()

Platforms: iOS 

Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.

Returns: Returns a Promise

API

Native

General