4

I'm trying to do a parallel preload of images using the logic implemented on the below link.

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

I have a huge amount of images, currently 350+ images with an average of 50KB file size each, amounting to a total of 20MB of images im trying to preload. I need the images for canvas drawing.

Using the above logic of parallel downloading, I'm having issues of the browser waiting for 2mins to finish loading the whole page. sometimes, it stops the script.

By the way, 20MB of images is currently the conservative amount of images. some set of images I need to preload my go to as much as 80MB!!

Is it even practical to preload such an amount of images? And if i need to preload, What is the best approach to my requirement? Should i do non-parallel? How about partial preload?

Thank you in advance Marv

Marvzz
  • 1,535
  • 3
  • 15
  • 22

1 Answers1

4

That is a perfect usecase for a MXHR (Multipart XHR) request. That means, a serverscript is reading your image files, decodes them as base64 string and streams those images to the browser. supplyJShelp is using this technique, but currently only for javascript & stylesheet files. Anyway, it's designed pretty modular, it should be no problem to extend it's functionality for any image type you need.

If you don't feel in the mood to do it yourself, don't worry - I'll update the script for image loading the next few days.

jAndy
  • 231,737
  • 57
  • 305
  • 359
  • I'll be looking forward to that script :) but for now I may need a quick solution for my issue. Thanks – Marvzz Jan 25 '11 at 11:01
  • 1
    Very nice source. If you have time could you give a couple bullet points on what to modify to work for this case? – mVChr Jan 25 '11 at 11:05
  • @mVChr: it's basically only copy&paste from the existing code. Adding a new MIME type listener, let's say `image/png` and do something with each image received. Watch out for an update soon. – jAndy Jan 25 '11 at 11:33
  • @jAndy "Delivering Javascript-, Stylesheet- **& Image-** files over one request..." that was quick, awesome, thanks! – mVChr Jan 26 '11 at 01:38
  • @jAndy thanks for the script! Hoping for a PHP version of the Mxhr library too! Sorry if it is too much to ask :) THanks – Marvzz Jan 26 '11 at 02:47