api photo ionic code example
Example: ionic camera
npm install cordova-plugin-camera
npm install @ionic-native/camera
ionic cap sync
...
import { Camera, CameraOptions } from '@ionic-native/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) => {
let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
});