How to disable 3X images to store and optimize?

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

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

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

5 Likes

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

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.

5 Likes
/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?

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.

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?

Any hints or points?

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

1 Like

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

2 Likes

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

I backup only content without uploads.

Should I just copy /optimized to /original ?

look at:

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

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

4 Likes
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?

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