I don’t take pictures directly via camera (yet), but i upload files via input type=“file”. Maybe my methods/functions can help you.
This is my change event that uploads the img:
onSelectFile(event) {
if (event.target.files && event.target.files[0]) {
const reader = new FileReader();
reader.readAsDataURL(event.target.files[0]); // read file as data url
reader.onload = (event) => {
// called once readAsDataURL is completed
this.imageDataURL = event.target.result as string;
this.attachmentService.base64$.next(this.imageDataURL);
this.openModal();
};
}
}
As you can see in the following code-block, I had to cut off the first part of the base64-code of the images: