react-native-image-gallery icon indicating copy to clipboard operation
react-native-image-gallery copied to clipboard

Image.getSize does not use headers

Open jberns88 opened this issue 6 years ago • 4 comments

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?

jberns88 avatar Mar 19 '18 14:03 jberns88

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

shubham1164 avatar May 13 '19 06:05 shubham1164

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

jberns88 avatar May 13 '19 09:05 jberns88

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

shubham1164 avatar May 13 '19 17:05 shubham1164

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

Quintis1212 avatar Feb 05 '22 18:02 Quintis1212