Showing a warning and making the user explicitly chose is one option to explore, but it has some potential drawbacks:
- For users that can display the image, the workflow is less fluent requiring one more upfront decision.
- For users that cannot display the image in more detail (they may just wanted the image a bit bigger to read some label) the options are to (a) crash the browser or (b) do nothing.
An alternative behaviour I was considering for huge files, is to load a "large" version of it (not the original huge one) and indicate so while the image is loading ("due to its big size, a scaled version of the file will be loaded instead. You can access the download icon to get or display the original file."). In this way, most users that are interested in just viewing some more details will be able to do so just by clicking, and those specifically interested on displaying huge images will do that in an explicit and more informed way (file size is shown in the download panel) and with a "download" option (less likely to break crash their browser) next to the "view in browser" one.
In any case, a notion of when a file is considered huge, and whether we should estimate that on resolution or file size will be very useful for whichever approach we choose.
Pau