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?
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
sam
(Sam Saffron)
21. Mai 2019 um 23:25
2
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?
sam
(Sam Saffron)
24. Juni 2019 um 07:09
4
This script should do it:
# frozen_string_literal: true
require File.expand_path("../../config/environment", __FILE__)
# no less than 1 megapixel
max_image_pixels = [ARGV[0].to_i, 1_000_000].max
puts '', "Downsizing uploads size to no more than #{max_image_pixels} pixels"
count = 0
Upload.where("lower(extension) in (?)", ['jpg', 'jpeg', 'gif', 'png']).find_each do |upload|
count += 1
print "\r%8d".freeze % count
absolute_path = Discourse.store.path_for(upload)
if absolute_path && FileHelper.is_supported_image?(upload.original_filename)
file = File.new(absolute_path) rescue nil
next unless file
image_info = FastImage.new(file) rescue nil
This file has been truncated. show original
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,5 GiB [##########] /original
35,6 GiB [###### ] /optimized
Bitte sagen Sie mir, welchen Ordner, /original oder /optimized, ich löschen kann, um etwas Speicherplatz freizugeben?
Wie @sam bereits sagte: Wenn Sie Ihren Festplattenverbrauch wirklich reduzieren möchten, müssen Sie alle Originalbilder verkleinern und alle Miniaturansichten neu generieren (d. h. „optimierte
OH NEIN!
Ich habe gerade meinen /original-Ordner beim Verschieben von einem Ordner in einen anderen beschädigt.
Gibt es eine Möglichkeit, Bilder aus dem /optimized-Ordner oder aus der Postgres-Datenbank zu verwenden?
Bin ich jetzt in Schwierigkeiten?
Gibt es Hinweise oder Tipps?
sam
(Sam Saffron)
30. Juni 2019 um 10:38
9
Du kannst versuchen, von optimiert wiederherzustellen, aber die Qualität wäre begrenzt.
Wenn Sie ein Backup haben, das Uploads enthält, können Sie diese direkt im originals-Ordner aus dem Archiv extrahieren.
Wie mache ich das? Ich habe den Ordner /optimized vollständig.
Ich backuppe nur den Inhalt ohne Uploads.
Sollte ich einfach /optimized nach /original kopieren?
sam
(Sam Saffron)
1. Juli 2019 um 00:01
14
Schau dir Folgendes an:
./launcher enter app
rails c
Upload.last(10)
Sieh dir die URLs dort an; dort erwarten wir die Uploads.
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
Enthält die Postgres-Datenbank auch Bilder? Ist das in Ordnung?
Die Dateien werden alle auf der Festplatte gespeichert, die Datenbank enthält nur Einträge zu bestimmten Metadaten.