Composer image resize threshold

Continuing the discussion from Client side image optimization enabled by default:

I’m the admin on a self-hosted Discourse instance for local photographers where we mostly upload high quality media. I’d like to change the default image width for the composer to resize down to but I’m not seeing it anywhere in the settings.

The ask bot told me to look for composer media optimization image resize dimensions threshold but I wonder if this setting has been deprecated or hidden because the only setting I can find is composer media optimization image enabled

Basically I just want images uploaded with the composer to be resized to a maximum width of 1440px instead of 1920px, and possibly have the option to only resize the longer side of the image (eg. a portrait image should be resized on its height instead of width.)


Version 2026.5.0-latest ( af1090fa6f )

it is a hidden setting so it can be changed in rails console

but i think it needs to be added here:

to change it:

cd /var/discourse
./launcher enter app
rails c
SiteSetting.composer_media_optimization_image_resize_dimensions_threshold = 1440
exit

Does the app need to be rebuilt after making this change?

No, but you need to refresh the page.

Is there a way to verify that I’ve configured it properly? Hard refresh (Ctrl+F5) didn’t seem to work, so I rebuilt the app anyway which didn’t make a difference either. Images are still resizing down to 1920px.

/var/www/discourse# rails c
Loading production environment (Rails 8.0.5)
discourse(prod)> SiteSetting.composer_media_optimization_image_resize_dimensions_threshold
=> 1440

i usually do a restart when changing a site setting

./launcher restart app

in rails console again, what value does it return when you enter: SiteSetting.composer_media_optimization_image_resize_dimensions_threshold

i just tested this specific change and it updated

It returns 1440

This image has an original resolution of 3089x2048, and here’s what it’s resized to after being uploaded just now as a test.

composer_media_optimization_image_resize_dimensions_threshold controls when it triggers.

If you want it resized to 1440, you need to set that as composer_media_optimization_image_resize_width_target.

Hmm, no dice.

I’ve set both of these values to 1440 and then to be safe did /var/discourse/launcher rebuild app but images are still resizing to 1920.

edit: actually after doing a rebuild and then going back to rails, the two variables are back to being undefined. Could something be overwriting them back to default?

Actually even after exiting from rails and just going back in, I get this:

discourse(prod)> composer_media_optimization_image_resize_dimensions_threshold
(discourse):1:in '<main>': undefined local variable or method 'composer_media_optimization_image_resize_dimensions_threshold' for main (NameError)