Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49286

App restarting while capturing the camera image

$
0
0

@Velmurugan wrote:

When i am capturing the image using camera , my app is restarting . but its working fine in picking the image from Gallery.

This is my ionic info .

image

this is my code

.TS

public base64Image:any

capturePicture(){
this.backgroundMode.enable();
const option: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
}
this.camera.getPicture(option).then((imageData) => {
this.base64Image = ‘data:image/jpeg;base64,’ + imageData;
alert(this.base64Image)
}, (err) => {
// Handle error
});
}

HTML.

<img *ngIf=“base64Image” src="{{this.base64Image}}">

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49286

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>