# How to disable 3X images to store and optimize?

**URL:** https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335
**Category:** Self-hosting
**Created:** [5월 21, 2019, 8:28오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335 "2019-05-21T20:28:38Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [5월 21, 2019, 8:28오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/1 "2019-05-21T20:28:38Z")

</div>

Hi,

I do have huge image local storage

```
/var/discourse/shared/standalone/uploads/default
  57.5GiB [##########] /original
  35.6GiB [######] /optimized

```

the original

```
  56.7GiB [##########] /3X
  667.6MiB [] /2X
  155.5MiB [] /1X

```

and optimized

```
   33.8GiB [##########] /3X
    1.7GiB [] /2X
  113.3MiB [] /1X

```

I found this settings and make this 1 and 2. Is it relevant settings?

![image](https://global.discourse-cdn.com/meta/original/3X/0/5/052ea7b34bf0024b7157808afd0f568cdc816567.png)

I would like to drop all 3X images (original and optimized) and store/show only 2X picture?  
How to setup this configuration?

T H A N K S

---

<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: [5월 21, 2019, 11:25오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/2 "2019-05-21T23:25:55Z")

</div>

3x is just a naming convention it has nothing to do with image size

If you want to cut on storage you could run the rake task that irreversibly shrinks old images and drops fidelity

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 24, 2019, 6:27오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/3 "2019-06-24T06:27:56Z")

</div>

> [@sam](#):
>
> If you want to cut on storage you could run the rake task that irreversibly shrinks old images and drops fidelity

how to do it? what’s the command line?

---

<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: [6월 24, 2019, 7:09오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/4 "2019-06-24T07:09:59Z")

</div>

This script should do it:

> <https://github.com/discourse/discourse/blob/4c89f7f88165c28bfc8ecb15a3be7346985d384e/script/downsize_uploads.rb>

But I would be very very careful to have a full backup of everything prior to playing with it.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 28, 2019, 11:15오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/5 "2019-06-28T11:15:49Z")

</div>

```
/var/discourse/shared/standalone/uploads/default
  57.5GiB [##########] /original
  35.6GiB [######] /optimized

```

please tell me which folder /original or /optimized I can drop to free up some space?

---

<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: [6월 28, 2019, 3:05오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/6 "2019-06-28T15:05:32Z")

</div>

Like @sam said, if you truly want to reduce your disk usage, you will need to downsize all your originals and re-generate all your thumbnails (ie. “optimized” images).

It’s an involved process since you have to update both the files on disk and the associated records in the database.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 28, 2019, 6:59오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/7 "2019-06-28T18:59:54Z")

</div>

GOSH!

I’ve just ruined my /original folder during moving from one folder to another.  
Is there any way to use images from /optimized folder? or from Postgres DB?

Am I in trouble now?

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 30, 2019, 5:17오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/8 "2019-06-30T05:17:23Z")

</div>

Any hints or points?

---

<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: [6월 30, 2019, 10:38오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/9 "2019-06-30T10:38:46Z")

</div>

You can try recovering from optimized, but quality would be limited

---

<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: [6월 30, 2019, 10:47오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/10 "2019-06-30T10:47:34Z")

</div>

If you have a backup that includes uploads, you can extract them from the archive directly in the originals directory.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 30, 2019, 1:04오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/11 "2019-06-30T13:04:53Z")

</div>

> [@sam](#):
>
> You can try recovering from optimized, but quality would be limited

How to do it? I do have /optimized folder in full.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 30, 2019, 1:05오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/12 "2019-06-30T13:05:22Z")

</div>

> [@zogstrip](#):
>
> If you have a backup that includes uploads, you can extract them from the archive directly in the originals directory.

I backup only content without uploads.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [6월 30, 2019, 6:47오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/13 "2019-06-30T18:47:51Z")

</div>

> [@sam](#):
>
> You can try recovering from optimized, but quality would be limited

Should I just copy /optimized to /original ?

---

<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: [7월 1, 2019, 12:01오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/14 "2019-07-01T00:01:22Z")

</div>

look at:

```plaintext
./launcher enter app
rails c
Upload.last(10)

```

See the urls there, that is where we expect the uploads to be.

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [7월 2, 2019, 7:43오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/15 "2019-07-02T19:43:21Z")

</div>

```plaintext
root@dastereo:/var/postgres_data_discourse# du -hs * | sort -rh | head -5
33G base
129M pg_wal
46M pg_xact
616K global
216K pg_subtrans

```

Does Postgres DB contain also pictures? Is it OK?

---

<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: [7월 3, 2019, 8:10오전 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/16 "2019-07-03T08:10:00Z")

</div>

The files are all stored on disk, the database only holds records of some metadata.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [12월 22, 2022, 2:24오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/17 "2022-12-22T14:24:58Z")

</div>



---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [12월 22, 2022, 2:30오후 UTC](https://meta.discourse.org/t/how-to-disable-3x-images-to-store-and-optimize/118335/18 "2022-12-22T14:30:04Z")

</div>


