Resize images after uploading


(Anton) #1

Continuing the discussion from Optimize images before uploading?:


If it’s not clear how to efficiently resize images client-side, we should probably resize them server-side after uploading.

Scenario

  1. A user uploads an image 10MB. It’s checked against a [newly created] setting max_upload_image_size_kb.
  2. The image is then resized to max_image_size_kb (for example, 3MB). So, no original image of 10MB is saved, but rather only the resized version 3MB.
  3. A thumbnail is created for image if its size is bigger than max_image_width and max_image_height (the way it works now).

This way we allow users to upload big images without the boredom of resizing them before uploading. In the same time, we only store reasonable size of the images, configurable in Settings.


(Sam Saffron) #2

We definitely need to start optimising full size images as well, atm we only optimise the thumbnails.


(Erlend Sogge Heggen) #3

Speaking of which, I’ve been meaning to point this out for a long, long time:

As far as I can tell, this rather large image that I’m using as a profile background is not resized in my profile pop-up. Every time I click my profile, it takes me well over a second to load the background. I’ve seen this in others’ profiles as well, and it’s quite jarring.

Even on my profile page, the background image ought to be optimised for screen size.


(Chris Saenz) #4

This would be REALLY helpful to my non-techie userbase.

Since we have limited storage on Digital Ocean, we can’t allow full size camera uploads anymore. I’ve imposed a strict 1MB limit to keep it under control (we have a LOT of photos). This means most people’s direct camera shots are too big, and must be downsized before posting.

Manually resizing all photos before uploading is annoying at best. To a less skilled user this can be frustratingly difficult, especially on mobile devices.

For us, bandwidth is not the immediate concern. I’d trade a lot of bandwidth for a simpler user experience.


(Jeff Atwood) #5

Sure after he gets back from honeymoon maybe @zogstrip can add this to his list?


(Régis Hanol) #6

Just pushed a fix to crop & optimize background images :tiger:

https://github.com/discourse/discourse/commit/b0802abae2f58b7b982808844cdc50aee462fd2b


(Régis Hanol) #7

This is now done. We’ll accept images of up to 10MB and then downsize them to the maximum allowed image size :leopard:

https://github.com/discourse/discourse/commit/ffbaf8c54269df2ce510de91245760fddce09896


Unable to resize images after uploading
Resizing images after upload settings
Image upload max size and further resizing regression issue
Limit number of images uploaded by user per day, wil TL multipliers
(Jeff Atwood) #8

This topic was automatically closed after 2 days. New replies are no longer allowed.