Hello! I have a problem with get the base64 option in takePictureAsync()
const takePicture = async () => {
if (cameraRef.current) {
const options = { quality: 0.5, base64: true };
const data = await cameraRef.current.takePictureAsync(options);
console.log('data',data.uri);
let formData = new FormData();
formData.append("image", data);
console.log('formdata',formData);
const source = data.uri;
if (source) {
await cameraRef.current.pausePreview();
setIsPreview(true);
console.log("picture source", source);
}
}
};
when the base64 option is false i got this in my console
{uri:“file:///var/mobile/Containers/Data/Application/7DFE9FF4-1075-4638-9E19-412BE46D338D/Library/Caches/ExponentExperienceData/%2540ilnanex%252Fb361af/Camera/EB0A868A-B8BC-49F9-974F-5447534609DB.jpg”,width:2160,height:3840}
but when i set to base64:true doesn’t work, i got no result, expecting result
{uri:“file:///var/mobile/Containers/Data/Application/7DFE9FF4-1075-4638-9E19-412BE46D338D/Library/Caches/ExponentExperienceData/%2540ilnanex%252Fb361af/Camera/EB0A868A-B8BC-49F9-974F-5447534609DB.jpg”,width:2160,height:3840, base64:some base64 image}
Any ideas?
Thanks