We are using the refile gem to display the images in our platform, they do work well on different browsers except for Microsoft Edge. Is there a different format or limitation for Microsoft Edge that I should know about it?
(I don't have Microsoft Edge, so can't test it directly)
Any help would be amazing. Thanks.
I've checked with MS Edge 25.10586.0.0 / EdgeHTML 13.10586 and images have not been displayed.
I suppose this happens because images are sent as application/octet-stream and Edge doesn't have enough informations to display them (need to be confirmed).
But on refile github page you could see it's possible to add metadata for each file loaded like:
These fields will be filled automatically after a file load and fixes the issue on my refile example app.
Disclaimer: Be carefull with the following actions, please make some tests before doing this on a production environment
It's possible to add missing informations to your existing files.
Currently
Refileseems to only use filename extension to extract the content-type. Therefore we need to extract the content-type with file content and create a filename with the corresponding extension for each uploaded file.There is probably many ways to do that. I'll describe a method I used on my refile application.
Here is my user model
First run the previous migration to add missing fields.
In the gemfile add the gem
mimemagicand runbundel install. This one can determine content-type of a file by the content.Then for each
Userextract profile_image's content-type and add a correct filename.And that's all.