如何禁用 3X 图像的存储和优化?

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

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

This script should do it:

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

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

请告诉我,为了释放一些空间,我可以删除哪个文件夹:/original 还是 /optimized?

正如 @sam 所说,如果你真的想减少磁盘占用,你需要缩小所有原始图片的尺寸,并重新生成所有缩略图(即“优化”后的图片)。

这是一个繁琐的过程,因为你既要更新磁盘上的文件,也要更新数据库中相关的记录。

天哪!

我在将文件从一个文件夹移动到另一个文件夹时,不小心弄坏了 /original 文件夹。
有没有办法从 /optimized 文件夹或 Postgres 数据库中使用图片?

我现在是不是麻烦了?

有什么提示或要点吗?

您可以尝试从优化状态恢复,但质量将受限。

如果您有一个包含上传文件的备份,可以直接从归档中提取它们到 originals 目录。

怎么做?我的完整版本中确实有 /optimized 文件夹。

我仅备份内容,不包含上传文件。

我应该直接把 /optimized 复制到 /original 吗?

请查看:

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

查看其中的 URL,那就是我们期望上传文件所在的位置。

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

Postgres 数据库是否也包含图片?这样没问题吗?

所有文件都存储在磁盘上,数据库仅保存部分元数据的记录。