Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images without file extensions don't appear #41

Open
pejalo opened this issue Feb 6, 2017 · 7 comments
Open

Images without file extensions don't appear #41

pejalo opened this issue Feb 6, 2017 · 7 comments

Comments

@pejalo
Copy link

pejalo commented Feb 6, 2017

With <Image>, the source URI doesn't need a file extension to be recognized and rendered properly as an image. I just tested <ResponsiveImage> and that also works.

@jayesbe
Copy link
Owner

jayesbe commented Feb 6, 2017

Do you have an example URI ?

@pejalo
Copy link
Author

pejalo commented Feb 6, 2017

Here's one: https://s3.amazonaws.com/timemachinemedia/00081e4c6376f8abb5305d447d8c378d_file

Thanks for looking into this!

@jayesbe
Copy link
Owner

jayesbe commented Feb 7, 2017

@pejalo

When I click this link in the browser, it tries to download. Doesn't that mean the URL is returning the incorrect mime/type? If it was an image shouldn't the browser display it ?

@pejalo
Copy link
Author

pejalo commented Feb 9, 2017

Hey @jayesbe you are probably right. The image was just uploaded as a blob of data to Amazon S3. Apparently AWS has no way of bulk-updating the HTTP headers that are served along with the file.

It makes sense that the browser can't download the entire file automatically and then inspect it to see what to do with it. But in the case of using a component like <Image> or <CacheableImage> it certainly is convenient to have it be treated like an image by default.

I ended up using this instead because it "just works" like <Image>:
https://github.com/kfiroo/react-native-cached-image
BTW I was also having issues with <CacheableImage> where sometimes they would not load. This is probably because I needed to render 20+ instances on the screen all at once.

@nbolender
Copy link
Contributor

I've found that iOS will not display a local image without an extension because it assumes PNG. More details here: #23 (comment)

The fix for this is to append an extension to the cached copy if one doesn't exist. The library you linked appends 'jpg' to any file without an extension: https://github.com/kfiroo/react-native-cached-image/blob/master/ImageCacheProvider.js#L41

@pejalo
Copy link
Author

pejalo commented Feb 10, 2017

Interesting... thanks @nbolender ! I wonder if <Image> uses the same approach.

@radik
Copy link

radik commented Apr 12, 2018

Thanks, @nbolender ! You saved my time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants