meliorence / react-native-image-gallery

Pure JavaScript image gallery component for iOS and Android with high-performance and native feeling in mind
715 stars 298 forks source link

Image.getSize does not use headers #74

Open jberns88 opened 6 years ago

jberns88 commented 6 years ago

When loading images with something like:

[
  {
    "source": {
      "uri": "http://my.files.com/123",
      "headers": {
        "Authorization": "BASIC ..."
      }
    }
  }
]

The gallery errors because the getSize cannot be given headers and therefore sets the state to error. As images are cached by React Native once they're loaded is it possible to run the getSize method after the image is loaded as a workaround?

shubham1164 commented 5 years ago

Hi @jberns88, I am facing a similar issue, have you found the answer on how to send headers while using Image.getSize(). I need this because I can't access the image without auth token that must be present in the header. Thanks in advance

jberns88 commented 5 years ago

Nope, I ended up fetching the image myself and passing it in as base64. It's not very efficient but did the job.

shubham1164 commented 5 years ago

Ammm....bad luck for me then...Thanks

Quintis1212 commented 2 years ago

@jberns88 , @shubham1164 Hi ! There are already get size method with headers https://reactnative.dev/docs/image#getsizewithheaders