Page MenuHomePhabricator

UploadWizard previews are memory intensive
Closed, ResolvedPublic

Description

While investigating UploadWizard behavior on mobile, I noticed that the preview functionality is pretty memory intensive, making it easily cause problems when uploading multiple images on mobile.

Every upload is read as a data url, base64 and then injected directly as the image. You have the entire transfer size, multiple times, and then the browser decodes the entire image to memory and then creates another copy scaled down etc etc.
Adding multiple images in your upload, that all have to do this, therefore quickly can fill up memory and crash the tab.

Details

Event Timeline

Change #1348652 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/UploadWizard@master] Decode image previews at thumbnail size

https://gerrit.wikimedia.org/r/1348652

Hmm. wondering if we should also remove the old file rotation logic and the filereader fallback and just fallback to thumbnails that are serverside rendered...
That basically means that a certain lineage of browsers around 2019-2021, would no longer get thumbnails before the upload stage, but it does simplify the code for these, which now each have 2 fallbacks.

Change #1348652 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Decode image previews at thumbnail size

https://gerrit.wikimedia.org/r/1348652

simon04 assigned this task to TheDJ.