Expo Image Picker Uri expires and is probably not the path to the locally stored Image

Viewed 11

like I said in the title. I spend hours on end trying to fix this and im thinking of ditching expo all together. When I pick an Image with the Image picker and safe it via AsyncStorage everything works finde for a few minutes. Im able to reload the App and the Image is still showing. But after a few Minutes the Image disappears. I found some workarounds for the normal image picker but not the expo one.

I also dont think the uri points to the place where the Image is stored, because the Uri looks like this:

file:///var/mobile/Containers/Data/Application/7436CFB1-C537-4252-ACEC-5F7EC0866E2D/Library/Caches/ExponentExperienceData/%2540johannesdberg%252FAcropendium/ImagePicker/E8CE1793-3906-401A-AA3C-CB0907FA9E24.mov

Is there a way to get the right path to the Image or make the uri persist?

const pickImage =async () => {
    let result = await ImagePicker.launchImageLibraryAsync({
      mediaTypes:ImagePicker.MediaTypeOptions.All,
      allowsEditing: true,
      aspect:[4,3],
      quality:1,
    })

    if (!result.cancelled){
      setImageUri(result.uri)

    }
    

  }

Sidenote: Why isnt anyone else running into that Problem? Like do you store Images/Videos in a database or on a server? I think this problem should be well known shoudn't it?

Ty for helping.

0 Answers
Related