# Limit number of images uploaded by user per day, wil TL multipliers

**URL:** https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690
**Category:** Feature
**Created:** [February 20, 2017, 11:14pm UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690 "2017-02-20T23:14:39Z")
**Posts on this page:** 20
**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: [February 20, 2017, 11:14pm UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/1 "2017-02-20T23:14:39Z")

</div>

We currently can limit number of posts, likes and topics per user depending on their trust level.

Because disk volume is an expensive resource for huge but non-profitable communities, please add settings to control the number of images one can upload daily, depending on their trust level.

In our community, I found out that some users submit too many similar images, which just eat space and add no value to their posts compared to if there were fewer images. An example would be 20x images when 3-4 images would be absolutely enough.

---

<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: [February 20, 2017, 11:21pm UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/2 "2017-02-20T23:21:39Z")

</div>

You should address this with a site feedback topic on your community, first.

They should know that server disk space is not free. So don’t upload 20 images when 3 would do…

---

<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: [February 20, 2017, 11:26pm UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/3 "2017-02-20T23:26:34Z")

</div>

Thanks for prompt reply. I’m doing so, but unfortunately it does not help. Especially with newbie users who still have to go through all Tutorials gradually.

---

<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: [February 21, 2017, 12:28am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/4 "2017-02-21T00:28:00Z")

</div>

One idea why they do upload many similar images is because there is a bulk upload feature. It might be easier to select all 20 images instead of choosing the best 3 to 4 images among them.

---

<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: [March 31, 2017, 4:48am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/5 "2017-03-31T04:48:25Z")

</div>

Would you say it is a plugin territory or a pr-welcome, or might become a planned feature?

---

<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 31, 2017, 4:53am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/6 "2017-03-31T04:53:48Z")

</div>

I think plugin, personally. Setting image size limits globally, which you can already do, should be first.

---

<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: [March 31, 2017, 5:44am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/7 "2017-03-31T05:44:02Z")

</div>

You mean the final image size after its upload and resize, right?

I mean, if I’m not mistaken, it allows to upload up to X MB images, but  
will resize to Y dimensions and save only the resized version, is that how  
it works?

Also, any way to resize down all existing images and those save another  
~20% space?

---

<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 31, 2017, 5:50am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/8 "2017-03-31T05:50:26Z")

</div>

@zogstrip can advise you on this.

---

<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 31, 2017, 6:24am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/9 "2017-03-31T06:24:02Z")

</div>

> [@meglio](#):
>
> I mean, if I’m not mistaken, it allows to upload up to X MB images, but  
> will resize to Y dimensions and save only the resized version, is that how  
> it works?

Yes, that’s how it works. We allow users to upload images larger than the site setting and then try to downsize it to less than the maximum allowed.

> [@meglio](#):
>
> Also, any way to resize down all existing images and those save another  
> ~20% space?

You will have to manually run `convert` on all the images stored on your server (and hopefully they aren’t stored in S3).

---

<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: [April 2, 2017, 4:15am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/10 "2017-04-02T04:15:15Z")

</div>

> [@zogstrip](#):
>
> Yes, that’s how it works. We allow users to upload images larger than the site setting and then try to downsize it to less than the maximum allowed.

So, can the max upload size be regulated in the site settings anywhere, or is it just some big number by default?

After an image is uploaded, will it be resized to match the “max image size kb” setting?

May you recommend any “sane” minimum that would allow for images good enough for browsing on the Internet, but not good enough for printing and viewing fullscreen at big screens? It is currently set to 1024 KB, and I wonder if I can make it even smaller to save on space. Any advice?

> [@zogstrip](#):
>
> You will have to manually run convert on all the images stored on your server (and hopefully they aren’t stored in S3).

They aren’t stored in S3. How do I run the convert, how save is it?  
– Many thanks for your help

_P.S. I think [this](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digialocean-block-storage-for-image-uploads/49535) would solve the issue, but still waiting for any official recommendations by the Discourse team._

---

<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: [April 11, 2017, 3:03am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/11 "2017-04-11T03:03:05Z")

</div>

@zogstrip, so I decreased the value of max\_image\_size\_kb setting. But now, I cannot upload images from my mobile phone bigger than configured in the setting.

I got confused - how do I make this work?

> [@zogstrip](#):
>
> Yes, that’s how it works. We allow users to upload images larger than the site setting and then try to downsize it to less than the maximum allowed.

Considering this comment of yours, I expect images up to 10MB should be acceptable when uploading:

> [@Resize images after uploading](https://meta.discourse.org/t/resize-images-after-uploading/30575/7):
>
> This is now done. We’ll accept images of up to 10MB and then downsize them to the maximum allowed image size leopard[https://github.com/discourse/discourse/commit/ffbaf8c54269df2ce510de91245760fddce09896](https://github.com/discourse/discourse/commit/ffbaf8c54269df2ce510de91245760fddce09896)

Looks like the current behavior is a regression?

---

<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: [April 11, 2017, 5:37am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/12 "2017-04-11T05:37:53Z")

</div>

- What value did you use for `max_image_size_kb`?
- What’s the size of the image you’re uploading?
- What error message did you get?
- Have you changed the NGINX `client_max_body_size` setting? (By default it’s 10MB)

---

<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: [April 11, 2017, 6:30am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/13 "2017-04-11T06:30:55Z")

</div>

Thanks for your ongoing assistance.

> [@zogstrip](#):
>
> What value did you use for max\_image\_size\_kb?

864

> [@zogstrip](#):
>
> What’s the size of the image you’re uploading?

~1.5MB

> [@zogstrip](#):
>
> What error message did you get?

It says that the images I’m trying to upload is too big and I up to 864KB images are accepted.

> [@zogstrip](#):
>
> Have you changed the NGINX client\_max\_body\_size setting? (By default it’s 10MB)

In my `app.yml` I found only this piece that may be related to uploads, but it says `50m`:

```plaintext
params:
  db_default_text_search_config: "pg_catalog.russian"
  ## Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres
  ## on 1GB install set to 128MB on a 4GB instance you may raise to 1GB
  db_shared_buffers: "256MB"
  #
  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed
  upload_size: 50m

```

---

<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: [April 11, 2017, 8:05am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/14 "2017-04-11T08:05:50Z")

</div>

> [@meglio](#):
>
> It says that the images I’m trying to upload is too big and I up to 864KB images are accepted.

Yeah, that’s the error message you get when we couldn’t resize your image down to the maximum allowed.

> [@meglio](#):
>
> In my app.yml I found only this piece that may be related to uploads, but it says `50m`:

That’s indeed how to change the `client_max_body_size` value 😉

> <https://github.com/discourse/discourse_docker/blob/659ab19e6fa2c8284a500da810bec00f02e6e2e3/templates/web.template.yml#L153>

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [April 18, 2017, 4:23am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/15 "2017-04-18T04:23:51Z")

</div>

> [@zogstrip](#):
>
> Yeah, that’s the error message you get when we couldn’t resize your image down to the maximum allowed.

in other words, there’s a maximum acceptable quality loss that Discourse will take before giving up and saying “can’t resize it that small”.

---

<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: [April 18, 2017, 4:42am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/16 "2017-04-18T04:42:07Z")

</div>

> [@riking](#):
>
> before giving up and saying “can’t resize it that small”.

Can we get such a message in place? It currently will just say that the image is too big, while it is not.

---

<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: [April 29, 2017, 4:10pm UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/17 "2017-04-29T16:10:44Z")

</div>

How can I solve the case when users post too many images in private messages?

It would be very helpful to limit at least that.

---

<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: [August 6, 2017, 11:42am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/18 "2017-08-06T11:42:16Z")

</div>

> [@meglio](#):
>
> How can I solve the case when users post too many images in private messages?

I’m still experiencing that issue of having too many images in private.

It looks pretty reasonable to be able to limit the number of images one can upload in private messages daily.

Anyone from the team thinks it should be a setting in the core product?

---

<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: [December 6, 2017, 12:36am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/19 "2017-12-06T00:36:03Z")

</div>

@angus, how time will it take you to create a plugin that adds a single setting to the admin panel like this:

**`Max number of images one can upload in private messages in 24 hours`**

We already have some logic in the code that prevents uploading images and shows an error message. For example, when the image is too big and can’t be resized by the system after uploading in a given amount of time, it gets rejected and an error message is shown.

This means we can use the same mechanism of rejecting an image. One hook is needed to the image upload process, with the following logic:

- if the message is private
- if the setting is non-empty (and non-zero)
- make a SQL query to find out how many attachments/images were uploaded in all private messages by the poster in the last 24 hours
- if the number of images equals to or bigger than the setting value, then reject with an error message

---

<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: [December 6, 2017, 12:37am UTC](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690/20 "2017-12-06T00:37:06Z")

</div>

Are you seeing a lot of abusive / bulk PM with lots of image uploads?

[Next page](https://meta.discourse.org/t/limit-number-of-images-uploaded-by-user-per-day-wil-tl-multipliers/57690.md?page=2)
