I have been attempting to utilize the output image from the takePictureAsync
function and upload it to a Digital Ocean Space using Expo. The uploading process with signed PUT URL appears to be functioning correctly, but I am encountering issues during the encoding stage. Here is the relevant code snippet:
const pictureResponse = await camera.current.takePictureAsync({ base64: true });
const spacesBase64 = `data:image/png;base64,${pictureResponse.base64}`;
const spacesBuffer = Buffer.from(spacesBase64, "base64");
const spacesBlob = new Blob([spacesBuffer]);
const spacesFile = new File([spacesBlob], "test.jpg", { type: "image/jpeg" });
fetch(`https://signedputurl.com`, { method: 'PUT', body: spacesFile });
After taking a picture, it is successfully displayed on my Digital Ocean Space and the file size appears correct. However, when trying to preview the URL, it does not render properly. Despite removing the data:image/png;base64
prefix, the issue persists.
The image result has been made public and can be viewed at . Perhaps this will provide some insight into the problem.