Hello, i can’t for the life of me figure out how to save an image from an <camerawidget_name>.imageBlobURL to SQL server. i have tried to fetch the blob object using javascript but nothing worked. What am i missing?
Code i tried:
fun2: async () =>{
await fetch(Camera1.imageBlobURL)
.then(response => response.blob()) // Gets the response and returns it as a blob
.then(img_blob => {
let objectURL = URL.createObjectURL(img_blob);
console.log(objectURL);
});
}
Hey @Wobbel ! Welcome back to the community. I’ll suggest you save the base64 of the image rather than the blob. You can directly use imageDataURL property (gives you base64). And then upload this string to the DB.
i get the following string: blob:d7d52d2f-e77f-454c-8d18-ba8ef4d55902?type=Base64, how do you use this to create an image? I cant figure it out. Thanks in advance!
Wow, thanks a lot! I was thinking way too hard, solution is (as it should be) really simple! For future readers, turns out that if you just save the imageDataURL to the database, it is saved as the complete base64 image string.