# Resize images after uploading

**URL:** https://meta.discourse.org/t/resize-images-after-uploading/30575
**Category:** Feature
**Created:** [June 29, 2015, 4:44am UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575 "2015-06-29T04:44:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [June 29, 2015, 4:44am UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/1 "2015-06-29T04:44:32Z")

</div>

Continuing the discussion from [Optimize images before uploading?](https://meta.discourse.org/t/optimize-images-before-uploading/17150/26):

> [@Optimize images before uploading?](https://meta.discourse.org/t/optimize-images-before-uploading/17150/26):
>
> > [@Optimize images before uploading?](https://meta.discourse.org/t/optimize-images-before-uploading/17150/22):
> >
> > The current 3mb limit is really bugging me as it is preventing phone uploads right now. If we up the limit to 10mb and then downsize the image to 3mb on the server side while we work this out it would seem a decent tradeoff.
> 
> We’ve recently upped that limit to 10MB. Not sure it has been committed to a new image yet. Thoughts @sam?

* * *

If it’s not clear how to efficiently resize images client-side, we should probably **resize them server-side after uploading**.

# Scenario

1. A user uploads an image 10MB. It’s checked against a [newly created] setting `max_upload_image_size_kb`.
2. The image is then resized to `max_image_size_kb` (for example, 3MB). So, no original image of 10MB is saved, but rather only the resized version 3MB.
3. A thumbnail is created for image if its size is bigger than `max_image_width` and `max_image_height` (the way it works now).

This way we allow users to upload big images without the boredom of resizing them before uploading. In the same time, we only store reasonable size of the images, configurable in Settings.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 7, 2015, 7:33am UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/2 "2015-07-07T07:33:32Z")

</div>

We definitely need to start optimising full size images as well, atm we only optimise the thumbnails.

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [July 7, 2015, 9:36am UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/3 "2015-07-07T09:36:09Z")

</div>

Speaking of which, I’ve been meaning to point this out for a long, long time:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/7/870d6ef80bbb2d4419c0fd5794411bde9f9d56ac.png) 

As far as I can tell, this rather large image that I’m using as a profile background is not resized in my profile pop-up. Every time I click my profile, it takes me well over a second to load the background. I’ve seen this in others’ profiles as well, and it’s quite jarring.

Even on my profile page, the background image ought to be optimised for screen size.

---

<div class="post-metadata">

### Author: ![ky\_metro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ky_metro/32/42807_2.png) [@ky\_metro](https://meta.discourse.org/u/ky_metro)
#### Post date: [July 8, 2015, 12:27pm UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/4 "2015-07-08T12:27:08Z")

</div>

This would be REALLY helpful to my non-techie userbase.

Since we have limited storage on Digital Ocean, we can’t allow full size camera uploads anymore. I’ve imposed a strict 1MB limit to keep it under control (we have a LOT of photos). This means most people’s direct camera shots are too big, and must be downsized before posting.

Manually resizing all photos before uploading is annoying at best. To a less skilled user this can be frustratingly difficult, especially on mobile devices.

For us, bandwidth is not the immediate concern. I’d trade a lot of bandwidth for a simpler user experience.

---

<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: [July 8, 2015, 7:34pm UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/5 "2015-07-08T19:34:16Z")

</div>

Sure after he gets back from honeymoon maybe @zogstrip can add this to his list?

---

<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: [July 15, 2015, 3:18pm UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/6 "2015-07-15T15:18:28Z")

</div>

> [@erlend\_sh](#):
>
> Even on my profile page, the background image ought to be optimised for screen size.

Just pushed a fix to crop & optimize background images 🐅

[https://github.com/discourse/discourse/commit/b0802abae2f58b7b982808844cdc50aee462fd2b](https://github.com/discourse/discourse/commit/b0802abae2f58b7b982808844cdc50aee462fd2b)

---

<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: [August 12, 2015, 4:34pm UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/7 "2015-08-12T16:34:19Z")

</div>

This is now done. We’ll accept images of up to 10MB and then downsize them to the maximum allowed image size 🐆

[https://github.com/discourse/discourse/commit/ffbaf8c54269df2ce510de91245760fddce09896](https://github.com/discourse/discourse/commit/ffbaf8c54269df2ce510de91245760fddce09896)

---

<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: [August 15, 2015, 1:28am UTC](https://meta.discourse.org/t/resize-images-after-uploading/30575/8 "2015-08-15T01:28:15Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
