0

could you please help me uploading the pictures I take using expo camera, below the code I'm using right now, I see the image in firebase storage with more that 5mb of size but it's unreadable, below the code I'm using :

  const takePic = async () => {
    let options = {
      quality: 1,
      exif: false,
      base64: true,
    };
    let newPhoto = await cameraRef.current.takePictureAsync(options);
    uploadToFirebase("data:image/jpg;base64," + newPhoto.base64);
    setPhoto(newPhoto);
  };

  const uploadToFirebase = async (uri) => {
    const file = new Blob([uri], { type: "image/jpg" });

    const storageRef = ref(storage, "reportEvent/image4");

    uploadBytes(storageRef, file).then((snapshot) => {
      console.log("Uploaded a blob or file!");
    });
  };

I expect previewing the picture in the firebase storage dashboard

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 31 '23 at 08:53

0 Answers0