GLImage not working with image from ImagePicker.launchImageLibraryAsync

Please provide the following:

  1. SDK Version: 3.21.3
  2. Platforms(Android/iOS/web/all): Android

Hi,

I’m trying to build an app that displays an image chosen from the device gallery (Android). To display the image I’m using a GLImage component from gl-react-image

This works:

<GLImage source={{ uri: “https://i.imgur.com/mKgVHMU.jpg” }} resizeMode=“contain” />

But when I try to do


this.setState({ photo: await ImagePicker.launchCameraAsync({}) });

This doesn’t work anymore

<GLImage source={{ uri: photo.uri }} resizeMode=“contain” />

With the error message “EXGL: Invailid pixel data argument for gl.texImageData2D”

photo.uri is a local file and looks like this:

file:/data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Fvintage-photo-editor-efc8a81e-8c91-448a-9044-367e8b53f333/ImagePicker/be070504-4511-467b-bb2d-3f95e7decb4c.jpg

Do I have to resolve this local file URI to a different kind of URI?

What am I doing wrong?

thanks!
John

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.