Ionenkamera
$ ionic cordova plugin add cordova-plugin-camera
$ npm install @awesome-cordova-plugins/camera
Courageous Copperhead
$ ionic cordova plugin add cordova-plugin-camera
$ npm install @awesome-cordova-plugins/camera
import { Camera, CameraOptions } from '@awesome-cordova-plugins/camera/ngx';
constructor(private camera: Camera) { }
...
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
// Handle error
});