Camera photo to base64

I am having some problems converting camera image to base64. Maybe any of you can help me with that. I will appreciate that.

Welcome to Ionic Forum. Some advice to help you and help others to help you:

  • Please, when sharing some problem related to a code, don’t post an image of it, post the code itself and format it with the tools provided in the text box.
  • Post the errors you are getting while using your method, no images too, just the formatted error message.
  • Comment what you already tried and searched and why it didn’t work.

The forum has a pinned post that explain this. You can also check here to more tips. Following this tips increase your chances of getting a good answer for your question and prevents duplicate questions.

1 Like

Camera service already can read file as base64.

private takePhoto():void {
    let camermaOptions: CameraOptions = {
      quality: 70,
      sourceType: 2,
      correctOrientation: true,
      targetWidth: 1920,
      targetHeight: 1080
    }; => {
      this.imageBase64 = 'data:image/jpeg;base64,' + imageData;
      // do something
    }, (err) => {

Hello @sonichk Sonichk thanks for your answer, but this function only allows me to select the picture from the library, do you know How can I activate the camera functions to take the picture?

Hello @leonardofmed, thanks for the recomendations i will consider in future questions.

1 Like