Preload a huge amount of images

I am trying to preload images in parallel using the logic implemented by the link below.

http://blog.lieldulev.com/2010/05/21/parallel-image-preloading-in-js/

I have a huge number of images, currently 350 images with an average file size of 50 KB each, which is a total of 20 MB of images that I am trying to preload. I need images for drawing a canvas.

Using the above parallel loading logic, I am having problems with the browser waiting for the completion of the 2-minute loading of the entire page. sometimes it stops the script.

By the way, 20 MB of images is currently a conservative number of images. some set of images that I need to preload, up to 80 MB!

Is it even possible to preset so many images? And if I need to preload, what is the best approach to my requirement? Should I do non-parallel? How about partial preloading?

Thanks in advance Marv

+4
source share
1 answer

This is the ideal solution for querying MXHR (Multipart XHR). This means that servercript reads your image files, decodes them as a base64 string, and transfers these images to the browser. supplyJS help uses this technique, but currently only for javascript and stylesheet files. In any case, it was developed quite modularly, so there is no problem to expand its functionality for any type of image that you need.

If you don’t feel in the mood to do it yourself, don’t worry - I will update the script to upload the image in the next few days.

+4
source

Source: https://habr.com/ru/post/1336941/


All Articles