Changing max_image_size_kb

We’re thinking of changing our setting for max image size kb, as we we started out with it quite high and need to save some S3 costs. I wanted to check my understanding before hitting the button.

I think this setting on setting only gets applied to new uploads? Is there a way to resize existing uploads to use the new max value (e.g. resize the originals of anything over the max)? I’m was sort of hoping something like bundle exec rake posts:rebake would do it (maybe)?

If that wouldn’t work, what’s the best approach here? An older build of discourse had a Rails script/downsize_uploads.rb but I think that’s gone from github now? Is there anything else or is my best bet just to use that code on a more recent Discourse - I think it uses megapixel as the constraint rather than kb?

Thanks for any help/advice.

1 Like

It was converted into rake uploads:downsize. Be sure to glance over the script code as this is a destructive action.

Nowadays the client side image compression should yield enough saving to keep image uploads in check. Do you have it enabled?

3 Likes

We have client compression working and it does really well at keeping the image sizes down since it was introduced. We’ve been live with Discourse since about May 2015, and probably never changed the max image size before so that rask task looks ideal - thank you!

3 Likes

Apologies in that I can’t sign the CLA due to my work, so without a PR wanted to pass on that…

…needs to be ARGV[1], otherwise it’s always using 500_000 regardless of what’s passed in. Thanks again for the pointer to the right task, all files resized and working great. :heart:

2 Likes

cc @CvX, do we need to update that?

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.