1

hoping someone can help me with this. Trying to take a picture with the camera and convert it to a base64 image. I read somewhere that it was built in to the camera, but not sure exactly how to do it. Heres how I setup the camera:

      <Camera
      ref={(cam) => {
        this.camera = cam;
      }}
      style={styles.preview}
      aspect={this.state.camera.aspect}
      captureTarget={this.state.camera.captureTarget}
      type={this.state.camera.type}
      flashMode={this.state.camera.flashMode}
      defaultTouchToFocus
      mirrorImage={false}
    />

Here is also my code for when the picture is taken:

  takePicture() {
if (this.camera) {
  this.camera.captureTarget()
    .then((data) => this.takePictureFunc(data) )
    .catch(err => console.error(err));
}

}

That object is just returning the location of the file it seems.. looking to have it return base64.. but can't figure out how to do so.

Joe Caraccio
  • 1,899
  • 3
  • 24
  • 41

0 Answers0