# Specifying maximum uploaded (not thumbnail) image width and height

**URL:** https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715
**Category:** Feature
**Created:** [March 24, 2015, 5:43pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715 "2015-03-24T17:43:26Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![scottfsmith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scottfsmith/32/50976_2.png) [@scottfsmith](https://meta.discourse.org/u/scottfsmith)
#### Post date: [March 24, 2015, 5:43pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/1 "2015-03-24T17:43:26Z")

</div>

Hi, I have a relatively new discourse site up, [http://growingfruit.org](http://growingfruit.org). Everything has been going great, in a way too great as I am getting lots of image uploads and at the current rate it could end up maxing out my hosting plan in a few years. I was having complaints from novice users not able to upload larger images so I upped that limit to 10MB. But, I am now seeing 100MB per week of uploads and the site is still young.

I don’t need a short-term solution to this problem but I would sleep better if I knew I could just compress the existing images on the server in /var/discourse/shared/standalone/uploads/default/nnn/ directories and not have anything break. It would be even better if I could resize them. I tried compressing one image and it still loaded fine and nothing seemed to break, but if there is metadata stored in the database about the images there could be some problem down the road perhaps.

Scott

---

<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: [March 24, 2015, 6:09pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/2 "2015-03-24T18:09:13Z")

</div>

I would **not** recommend altering images on the server. While it won’t break if you keep the same filename, we use the SHA1 of the file to identify them and altering the image will cause problem at some point…

Also, have you changed the `max_image_width` and `max_image_height` settings? Seems like some images aren’t properly thumbnailed.

---

<div class="post-metadata">

### Author: ![scottfsmith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scottfsmith/32/50976_2.png) [@scottfsmith](https://meta.discourse.org/u/scottfsmith)
#### Post date: [March 24, 2015, 6:26pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/3 "2015-03-24T18:26:11Z")

</div>

Ah well. In that case I hope at some future date there is built-in support for server-side image compression and resizing. I expect it will be a problem for any picture-heavy forum running on a virtual host, they don’t give you a whole lot of disk.

> [@zogstrip](#):
>
> have you changed the max\_image\_width and max\_image\_height settings?

People on the site like to see detailed pictures so I did alter the image size. It doesn’t fit with the design well unfortunately, but it does put a large image up right away for them.

Scott

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 24, 2015, 10:00pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/4 "2015-03-24T22:00:06Z")

</div>

What you are asking for already exists, it is just that 10mb images are, well, 10mb images. Get a lot of those every day and you’ll need a lot of space. Or are you proposing that the server only store a 1000x1000 version of the 5000x5000 original image that was uploaded?

---

<div class="post-metadata">

### Author: ![scottfsmith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scottfsmith/32/50976_2.png) [@scottfsmith](https://meta.discourse.org/u/scottfsmith)
#### Post date: [March 25, 2015, 12:44am UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/5 "2015-03-25T00:44:26Z")

</div>

I would prefer to resize to something like 2000x2000, and reduce the quality if it was high. At some point images become so many pixels that a large pixel size has almost as much downside as upside for the average viewer: if you hit the zoom you only see a small portion of it. Converting 4000x4000 high quality to 2000x2000 medium quality would reduce the space by 5-6x and could solve my long-term hosting problem.

Scott

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 25, 2015, 1:46am UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/6 "2015-03-25T01:46:55Z")

</div>

Sure @zogstrip maybe you can add to your long term todo list, to set an absolute maximum dimension width x height of images that we will store on disk, anything larger than that gets auto resized to the max width x height and saved to disk.

So that way if they upload a 10mb 5000 x 5000 image only a 2mb 1000 x 1000 image will be saved to disk and shown to users. (This should not affect thumbnails)

Longer term we need multiple thumbnail sizes anyway to fix mobile bouncing issues.

---

<div class="post-metadata">

### Author: ![scottfsmith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scottfsmith/32/50976_2.png) [@scottfsmith](https://meta.discourse.org/u/scottfsmith)
#### Post date: [March 25, 2015, 1:28pm UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/7 "2015-03-25T13:28:44Z")

</div>

Great, I’m sleeping better already 😄

> [@codinghorror](#):
>
> a 10mb 5000 x 5000 image only a 2mb 1000 x 1000

More like 400kb - 1/25th the pixels.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 18, 2017, 10:24am UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/8 "2017-04-18T10:24:19Z")

</div>

This was completed a while ago.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [April 18, 2017, 10:24am UTC](https://meta.discourse.org/t/specifying-maximum-uploaded-not-thumbnail-image-width-and-height/26715/9 "2017-04-18T10:24:23Z")

</div>


