Welcome to Codidact Meta!
Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.
Comments on Browser-Specific Image Problems
Parent
Browser-Specific Image Problems
There have been some "images don't display in all browsers" problems. This is a test of that. Each image is "Test Image" in magenta/pink letters on a white background.
PNG
JPG
TIF
BMP
Tested using browserstack.com:
- Windows 7 & 10 Firefox: TIF does not display
- Windows 7 & 10 Chrome: TIF does not display
- Windows 7 & 10 Opera: TIF does not display
- Windows 7 & 10 IE: BMP does not display
- Windows 7 & 10 Edge: TIF does not display
- Mac Safari: No problems!
- Mac Firefox: TIF does not display
- Mac Chrome: TIF does not display
- Mac Opera: TIF does not display
- Mac Edge: TIF does not display
- Android (Google Pixel 4) Chrome: TIF does not display
- Android (Google Pixel 4) Firefox: TIF does not display
- iOS (iPhone 11) Safari: No problems!
- iOS (iPhone 11) Chrome: No problems!
This appears to not be a Codidact problem per se:
- If I try to display the files directly (file://c:/etc. as a URL) in Firefox, the PNG, JPG and BMP all work as expected but TIF ends up as a download.
- Another (ahem) helpful site has some information about this problem.
So it appears that JPG and PNG are the only truly reliable image formats. Actually, I'm 99+% certain that GIF is also universal, but generally speaking JPG and PNG are preferred to GIF.
Probably no quick & easy solution. Suggestions:
- Check filetype on upload and only allow if filetype (based on contents, not simply file extension) is PNG, JPG or GIF. This has the advantage of not just blocking marginal image formats but also helping to block malicious Javascript or other nasty stuff.
- Detect BMP and TIF and offer to convert to JPG or PNG using ImageMagick or a similar system.
Post
Completed pending deploy: we'll only allow web-safe image types (PNG, JPEG, GIF). I looked at automatically converting other image types, but it's frustratingly difficult in our current version of Rails - once we upgrade (no timeline on that yet), we might be able to look again.
1 comment thread