Closed Hultner closed 5 years ago
This is because we create thumbnails of all images being uploaded to the site. (See https://github.com/cthit/chalmersit-rails/blob/master/app/uploaders/article_image_uploader.rb#L30-L32). Also, the artificial limit is defined here as 1000x1000.
I agree with the "jagged" design comment though, so maybe we just remove thumbnail creation? Not sure that we need a separate media asset host? Good external hosts - I'm indifferent, but how do we communicate that some hosts are allowed and some aren't?
Quick question: do we ever not use the thumb version of the images? It seems to me like we could skip the thumb (500x500) version altogether.
Great @lindskogen! Seems like the thumbnail might be unnecessary, however I do see a point in sanitizing input images from unnecessary data and apply lossless compression.
The quickest solution to the main problem would be up the limit to something more sensible i.e. 1500px or 2000px (there's devices with device pixel ratio 3 I think, if not they're likely to be available soon) and remove the thumbnail version altogether unless it's strictly needed somewhere else.
For external hosts one solution could also be either always proxy them like github does or not allow them at all. Although maybe Chalmers.it might be too niche for someone to spend resources to exploit our external host support for tracking.
Another thing that would be really nice would be SVG support, which of course would need sanitizing from script-tags, but there must be a Ruby-library which can handle this?
As for separate media asset host I'm not meaning that we need another physical host as the only thing used to limit connections is the domain/hostname so we could literary just use another subdomain alias to the same server, quite trivial approach. However it might be overkill if speed is not an issue.
Doesn't HTTP2 negate the need for multiple media domains, though?
It does, it’s one of the mayor improvements but we aren’t really there yet. However that part is more as a side note to the actual issue here.
Problem
The new's-flow on Chalmers.it get a very jagged flow since the banners hosted on our internal banner is resized to rather small width of 500px, especially in todays climate where HighDPI & retina devices are commonplace. This limitation is not present for external hosts which can utilize the full width of the page. I.e. on my LG Ultrafine monitor the container 1373 physical pixels on the front page and 1274 pixels on following pages. Also I'm a bit sceptic to even allow external hosts unless they're on a tight list of approved such for privacy reasons (external tracking, mixed content, etc).
Example
Example showing the problem, in the first post the image hosted in imgur spans almost the full width while the second hosted on Chalmers.it roughly spans 1/3 of the div.
Mitigation
My suggestion is to remove this artificial limit and allow the pictures to be at least 1500px wide to accommodate for modern displays.
Further improvements
When investigating this issue I noticed some low hanging fruit