Feature NPM Resource Changed PR-5.3-dev Performance Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
10 Feb 2025

Summary of Changes

The PR changes the media manager to use FormData for file upload, instead of base64 payload.
Which improves responsiveness, performance and handling of large files in general.

However the api/ calls still uses base64 because it is hard to do in b/c maner.

Bonus: the upload progres now showing actual upload progress.

Testing Instructions

Apply patch.
Run npm install.
Go to media manager and try upload something bigger than 100Mb

Addittionaly, test with any 3d filesystem plugin.

Actual result BEFORE applying this Pull Request

The browser hangs for a while, and dependent from your luck the upload will be completed after some waiting.

Expected result AFTER applying this Pull Request

The upload starts immediately, and you can see progress (a litle 5px blue line over the files list)

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: IDK
  • No documentation changes for manual.joomla.org needed
avatar Fedik Fedik - open - 10 Feb 2025
avatar Fedik Fedik - change - 10 Feb 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Feb 2025
Category JavaScript Administration com_media NPM Change Repository Front End Plugins
avatar Fedik Fedik - change - 10 Feb 2025
Labels Added: Feature NPM Resource Changed PR-5.3-dev Performance
807d21a 10 Feb 2025 avatar Fedik cs
7ba8331 10 Feb 2025 avatar Fedik cs
avatar Fedik Fedik - change - 10 Feb 2025
Title
[5.3] Media: fix large file upload with use of binary upload instead of base64, and display correct upload progress
[5.3] Media: fix large file upload by using of binary upload instead of base64, and display correct upload progress
avatar Fedik Fedik - edited - 10 Feb 2025
avatar laoneo
laoneo - comment - 11 Feb 2025

I like that change, but this will break 3rd party extensions when the data can be all of the sudden a resource. I would read the file content it in the api controller and then pass it to the adapter the same way as before that no changes are needed in the adapter. Additionally, the check content logic can probably be moved to the, but not sure about this.

avatar richard67
richard67 - comment - 11 Feb 2025

Additionally, the check content logic can probably be moved to the, but not sure about this.

@laoneo Moved to the ... what?

avatar laoneo
laoneo - comment - 11 Feb 2025

ApiController

avatar Fedik
Fedik - comment - 11 Feb 2025

Hmhm,

I would read the file content it in the api controller and then pass it to the adapter the same way as before that no changes are needed in the adapter

No no, this not going to work, you will get "out of memory" error when try to read 100Mb file when PHP limit is 60Mb.
This will bring back problem with large file upload.
Loading whole file in to memory should never happen while uploading (unless when it realy need).

What about stringable object?
We wrap uploaded file in to that object, and the file will be loaded in to memory only when the plugin expecting a string. Addittionaly we deprecate this behavior.
What do you think?

avatar laoneo
laoneo - comment - 11 Feb 2025

Not sure if stringable would solve it. But I think the main goal should be to do it in a bc way.

avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2025
Category JavaScript Administration com_media NPM Change Repository Front End Plugins JavaScript Administration com_media NPM Change Repository Libraries Front End Plugins
avatar Fedik
Fedik - comment - 11 Feb 2025

I updated the code to use stringable object.
In my tests it works well even when try to access the data as to the string.

Would be good to have some more test, to be sure, with 3rd filesystem adapters.

avatar Fedik Fedik - change - 12 Feb 2025
The description was changed
avatar Fedik Fedik - edited - 12 Feb 2025
avatar Fedik Fedik - change - 12 Feb 2025
The description was changed
avatar Fedik Fedik - edited - 12 Feb 2025
avatar Fedik Fedik - change - 12 Feb 2025
The description was changed
avatar Fedik Fedik - edited - 12 Feb 2025

Add a Comment

Login with GitHub to post a comment