jquery-fancyfileuploader icon indicating copy to clipboard operation
jquery-fancyfileuploader copied to clipboard

Issue with large and multiple images

Open enesk opened this issue 2 years ago • 3 comments

I am trying to upload 2k images at once, my browser is crashing than.

Is it possible to preview images one after one?

enesk avatar Jun 06 '23 21:06 enesk

Please provide some additional details. I haven't tried to upload 2,000 images all at once before. I don't think file size should be an issue but rather how many UI elements get injected into the DOM. Can you provide some steps to replicate the web browser crash?

cubiclesoft avatar Jun 07 '23 20:06 cubiclesoft

I also think, it is about DOM. Because of that, it is important to show them one after one and not all at once.

To replicate this you only need to upload multiple items min. 500-1000..

enesk avatar Jun 07 '23 20:06 enesk

Well, I don't have that many images and my computer is fast/capable enough to not reproduce the issue.

Hazarding a wild guess, what happens if you replace this code:

			uploads.append(inforow);

			if (settings.added)  settings.added.call(inforow, e, data);

With this code:

			setTimeout(function() {
				uploads.append(inforow);

				if (settings.added)  settings.added.call(inforow, e, data);
			}, 0);

That should make it so the function won't insert anything into the DOM to force a redraw operation until there is available overhead in the browser. The AddFile() function is at the mercy of the jQuery File Upload callback, which will call the function for each and every file dropped onto the widget as fast as it possibly can. While there will still be DOM nodes that get created, they won't trigger a redraw operation until they get attached to the DOM itself. If that still causes problems, maybe wrap the entire interior of AddFile() with a setTimeout()?

As to a web browser crash itself, I rarely see browser crashes these days. If you are running a 32-bit web browser, you could be running up against 3-4GB RAM limitations of 32-bit software where if they run out of RAM, they will tend to be less stable. The widget isn't exactly subtle on DOM resource usage either.

cubiclesoft avatar Jul 01 '23 20:07 cubiclesoft