Was that given a go?
Another example of what is possible on ImageOptimization in browser:
This video goes over the tech. They compiled the state of art codecs (the same we use on the server for Discourse) to WASM 
Looks like a cool, optional thing for Discourse.
The WASM for mozjpeg can be compressed to 48k and the WASM for OptiPNG is 93k.
My image folder grows to 42.3 GB.
So I think I need to figure out image processing and storing in Discourse ![]()
I’m not sure if this is the right topic to post on, but I am very interested in knowing if there’s a way to automatically downsize images before they get stored in my discourse. My community is going to be very image heavy.
I’m less than a week in and already 350 MB used and not even open to general public yet. Would like to be able to resize images down to some resolution so that I keep them < 1MB or something like that (based on image resolution though as per norm I think).
I’d recommend using Digital Ocean spaces or S3 for your images so you don’t need to worry about space so much.
It seems unlikely that a community that really likes images is going to want really bad ones. 
We already have max_image_megapixels site setting, can you try toning that down?
@sam Yes, but, the problem is there’s a big difference between reducing some resolution that most people won’t even notice (IMO big diminishing returns), versus blocking them from uploading at all. On my main site, I downsize to 1500x and no one cares. But if they can’t upload it’s a huge hassle.
@pfaffman This sounds perfect, I guess I need to read:
I wonder, this is probably something I need to do sooner than later, because I’m guessing trying to migrate the files from discourse hosting to s3 could be hard?
I do support a simpler mechanism longer term, something like
All images must be smaller than 500k but allow people to upload stuff up to 2000k and fix on server if needed by either downsizing or reducing resolution. Try resizing on client first if possible.
But yeah, getting to this level of fidelity will take quite a while.
There is a rake task that will do it, but I’d say that sooner is better than later. ![]()
Die meisten unserer Nutzer verwenden mobile Daten, und manchmal liegt ihre Internetgeschwindigkeit bei 3G oder darunter. Oft ist die Qualität der gesendeten Bilder nicht entscheidend; für sie ist Geschwindigkeit wichtiger.
Beim 3G-Upload (ca. 2 Mbit/s) dauert das Senden eines 5-MB-Bildes etwa 20 Sekunden. Bei geringerer Geschwindigkeit kann diese Zeit deutlich länger sein.
Wie @Falco anmerkt, lässt sich mit ähnlichen Algorithmen die Größe eines 5-MB-Bildes durch Komprimierung auf Client-Seite und Verkleinerung der Abmessungen auf 190 KB reduzieren. Dadurch wird das Senden schneller (bei 3G ca. 1 Sekunde) und es werden weniger Ressourcen benötigt.
Gibt es eine solche Funktion im Roadmap? Falls ja, ist sie eher fern oder nah?
Das ist etwas, das wir langfristig umsetzen möchten, aber es steht nicht in unserem öffentlichen Fahrplan unter #releases.
Ich werde diese Woche ein RFC zu dieser Funktion verfassen, damit wir zumindest auf Spezifikationsebene vorankommen können.
Das ist unter iOS bereits möglich. So geht’s (Screenshot folgt, bitte kurz warten)
Über
Ich habe „Groß“ ausgewählt. Trotzdem wird die Ausrichtung falsch angezeigt!
Danke, das ist großartig
![]()
Ich wünschte, Android würde auch lernen ![]()
Zusätzlich zu dieser Funktion kann Lightbox ein Bildrotations-Button sein
Diese Bibliothek sieht interessant aus: GitHub - silvia-odwyer/photon: ⚡ Rust/WebAssembly image processing library · GitHub
Eine WASM-Binärdatei scheint die ideale Wahl zu sein, da sie schnell und speichereffizient ist.
Ich bin neugierig, ob eine Client-seitige Bildkomprimierung, wenn möglich, einen spürbaren Einfluss auf die Leistung von Webservern mit geringer Hardwareausstattung hätte (z. B. eine geteilte CPU-Instanz bei DigitalOcean).
Ich stelle gelegentlich einen Anstieg der CPU-Auslastung fest, der meiner Meinung nach mit dem Hochladen von Bildern durch Benutzer zusammenhängt, die komprimiert werden müssen. Hat jemand ähnliche Auswirkungen beobachtet?
Diskussion zur Implementierung unter Optional image optimization before upload


