DiscourseでのアップロードがRust、WebAssembly、MozJPEGでより高速(かつ小型)に | ブログ

As of a few weeks ago, image uploads in Discourse are faster AND smaller thanks to a technique that compresses and optimizes the images clientside before they are uploaded. This blog post will describe how this feature works and how we implemented it in Discourse.


This is a companion discussion topic for the original entry at https://blog.discourse.org/2021/07/faster-user-uploads-on-discourse-with-rust-webassembly-and-mozjpeg/
「いいね!」 50

Amazing! :heart_eyes: This is an incredible improvement. Really great work. It’s so much more fun to upload and share photos in discussions now.

And an added benefit - people on slow connections are going to be able to upload a bunch of photos at a time now without the dreaded “Uploading…” appearing instead of the photo. :+1:

「いいね!」 21

Nice improvement… and Happy Birthday, Rafael!

「いいね!」 13

Super psyched to see Discourse playing more with the power of Rust! :crab: :muscle:

imageflow is another impressive Rust lib in this space.

I took the liberty of sharing the news here:

「いいね!」 17

This is something I have on my site right now? Meaning y’all shipped this level of improved functionality out to everyone just because you want a better product?

Part of me knows that’s true. I’ve been around enough to know how y’all roll, but damn. Part of me feels like I missed the part where this is an advanced optimization play.

「いいね!」 9

Yes and yes. :smiley:

「いいね!」 8

Freakin’ radical, man.

Bill Murray Thank You GIF by filmeditor

「いいね!」 9

Getting lots of complaints from Android users about jumping cursors and degraded upload performance, unfortunately.

「いいね!」 3

I have a PR open that will greatly improve the cursor/placeholder handling during multiple file uploads

If all of the following are true:

  • You don’t care about storage costs
  • Most of your user base has good internet upload
  • Most of your audience browses from average or worse Android phones

You may want to either disable the feature or tweak the threshold for minimum size up a few megabytes.

「いいね!」 10

That’s great to hear!

Sadly, many of my users have cheap-ish/older Android phones, so I won’t be re-enabling the feature any time soon. Haven’t had any problems myself on my iPhone 12.

「いいね!」 5

Falco, would it be possible or of interest to provide a user setting for this, so people who want it can choose to use it? Or an option to “use classic image uploader” as craigslist does it? Selecting that button toggles the upload method.

「いいね!」 5

Maybe tweak the minimum size for it, so it’s only triggers on file larger than 3MB, so old phones won’t reach it on their own camera pictures.

That was included in the original RFC but it was removed according to the comments received.

「いいね!」 6

Hi Rafael,

I think we have a little problem with the new placeholder handling. It seems the images goes inline not a new line. Not just on composer pre optimization but regular uploads too. Thanks :slightly_smiling_face:

「いいね!」 5

This should fix it

「いいね!」 9

Hello Rafael,

Sorry I am late but tested just now. :confused: It works fine on multiple uploads if i drag images in new line but it seems the issue still there if drag image(s) the end of a text. Thank you :slightly_smiling_face:

「いいね!」 4

Is it all good now @Don?

「いいね!」 6

It seems to this one still happening.

「いいね!」 4

Has this been fixed? @Falco

「いいね!」 4

Sorry, what is a bug in that video? That looks exactly as I would expect it to work?

「いいね!」 6

I missed this feature A setting to always insert images as separate paragraphs - #16 by andrei which is I think works well until this commit Faster (and smaller) uploads in Discourse with Rust, WebAssembly and MozJPEG | Blog - #9 by Falco not sure. :confused:

I have a video from my community about this feature when I presented to the members.

「いいね!」 5