# Resizing images after upload settings

**URL:** <https://meta.discourse.org/t/resizing-images-after-upload-settings/72889>\
**Category:** Self-hosting\
**Created:** [October 27, 2017, 1:58am UTC](https://meta.discourse.org/t/resizing-images-after-upload-settings/72889 "2017-10-27T01:58:41Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [October 27, 2017, 10:13am UTC](https://meta.discourse.org/t/resizing-images-after-upload-settings/72889/14 "2017-10-27T10:13:15Z")

</div>

> [@schungx](#):
>
> It has been said that Discourse will scale down very large images in the background; how large is very large, and how much to scale down has always remained a mystery.

It’s not a mystery if it’s written in [plain text](https://github.com/discourse/discourse/blob/master/lib/upload_creator.rb) 😉

Ok, so here’s what happens when a user uploads an image

- NGINX accepts the image up to its “`client_max_body_size`” setting (defaults to 10MB, can be overwritten in `app.yml`)
- Then, we’ll convert [large](https://github.com/discourse/discourse/blob/90d6677d97626346ea8e0c6321f19ebda6aeb918/lib/upload_creator.rb#L124) PNG/BMPs to JPEG to keep the filesize at bay
- Then, we’ll halve (up to 3 times) the uploaded image until it’s lower than the “`max image size kb`” site setting
- If the image is still larger, then we’ll reject it 💥
- Then, go on with the upload process (fix orientation, crop, optimize…)

---

_[View the full topic](https://meta.discourse.org/t/resizing-images-after-upload-settings/72889)._
