Unable to resize images after uploading

Continuing the discussion from Resize images after uploading:


I’ve been looking forward to this feature for a long time. I just upgraded to the current version of Discourse, and it’s not working. I’ve tried to reproduce this in various places with varying results.

  • This is the test image, 5.48 mb: https://www.ushpa.aero/media/photos/pg_2008_00_hires.jpg

  • At my main website, uploading this image goes fine until it reaches 100%, then it stays at “Uploading 100%” forever.

  • On a small dev install (also on current version) it gets to 100% then starts over from 0%. Repeats this indefinitely.

  • On http://try.discourse.org (and here on meta) it uploads to 100% then says “Sorry, the image you are trying to upload is too big (maximum size is 3072KB), please resize it and try again.” Possibly these are not on the latest version?

Steps to repro:

  1. Find an image larger than the image size limit but less than 10MB.
  2. Try to upload it.
1 Like

Can you clarify @zogstrip?

This image storage size limit is not enabled on try or meta at the moment, so you would have to enable the limit and then test on your site.

Ok, I’ve found the :bug: . It happens that IO.size is cached and while we were actually downsizing the image, the algorithm was always checking the same file size… Thus resulting in an error when uploading a file larger than the image size limit…

https://github.com/discourse/discourse/commit/827ea641b04396e2cc3f5c8298c3ad475b1a4eff

3 Likes

This is most likely the source of the other bug I reported with uploads taking so long I gave up - they were going to take forever!

1 Like

Yup, especially for large PNGs…