Resizing images after user has uploaded automatically

Hiya! I’ve just set up an instance of discourse and I wondered, is there an easy way for images to be resized after a use has uploaded them? I’ve had quite a few people use the board already with images that are a few MB each!
Thanks,
Jack

1 Like

Do nothing. They will be resized. If you search, you can find some discussion about it.

1 Like

Oh right, they don’t seem to have changed yet - I did search but will have another look, thanks.

2 Likes

Hiya, they still aren’t resizing, have I missed something really obvious?

You will need to edit your image related site settings if you want to clamp down on uploads so hard. A few megabytes isn’t a big deal for an image.

1 Like

If you’re worried about running out of local storage on the server have you considered moving uploads into S3?

1 Like

Ah brill, thank you I found the setting and have adjusted it. I run a gardening board so it will become full of photos quite quickly which could become costly for a non-profit making site (at the moment). Thank for you help.

What is the setting name you changed?

I’m not sure what that means lol but I will ask my more technical partner to explain to me. Thank you.

Settings > Max Image size

I changed it to 1000kb for now. I was thrown because it didn’t change existing images, only newly uploaded ones. I might up the size in time but as a new board, I wanted to catch huge images early!

I believed that decreasing this setting would make Discourse throw an error if someone wanted to send a heavier image, which I guess would prevent a lot of people from uploading an image from their smartphone where the photos aren’t much compressed… :thinking:

2 Likes

Oh right, I just managed to upload one from my laptop but will check from my phone too

I just checked on mobile and laptop and it seems to work unless there’s an extra use case I’m missing? Tested on iphone and mac

Fair warning, in my opinion you are throwing the baby out with the bathwater here. People aren’t likely to return to a site that prohibits them from sharing an image over 1 megabyte in size.

It’s your site so you can do as you please but I expect people not to return once they run into that severe limitation.

Thanks Jeff, it doesn’t feel like a limitation to me because they can post, it just keeps the file size low. The images are still large and high quality for sharing purposes. I’ll keep an eye on it over time. At the moment, if I allow 4 - 8MB images on my server, the cost of hosting after a year of content could be in the hundreds of pounds, which I can’t afford.

2 Likes

Oh, that’s fair – much better approach. I thought you were blocking all uploads greater than 1MB in size.

2 Likes

Oh I see what you mean, no definitely not, just resizing them

It seems I never read the end of the max image size kb setting description, which provides a key info I had no clue about.

Images larger than this and smaller than client_max_body_size will be resized to fit on upload.

Good to know!

2 Likes

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