I've found a few posts, but they seem quite dated now. Can somebody tell me if there is any standard preloading that happens in ZenPhoto? Or should I be putting the printPreloadScript on my image pages?
On that subject, would it be better to simply use getNextImageURL and set it's display:none? That way, the preload wouldn't be dependent on Javascript.
Lastly, is there a standard way to load the next, say, 3 images instead of just the next one?
Thanks in advance for any input.
Zenphoto does not preload by default, since it follows the concept of "lazy evaluation", which means images are loaded when requested. (preloading can cause overhead on slower computers with slowers connections/servers.)
There is no way to do that without the javascript you mentioned. Also there are lots of other js solutions out there you could try to adapt.
The printPreloadScript is just an example, for the most part. Your way would work just as well. You can load the image with 1x1 pixel size too, and then display:none of course.
If you want the next three, load the next three. Look at the way printPreloadScript works to see how.
okay - thanks!
but i'm confused. am i correct that the method i'm suggesting does indeed accomplish the preload without Javascript? It's a minor issue; just curious. Thanks.
It's been working fine like that for me since I did my own theme years ago. I've been meaning to merge the playing with js I did into the active theme, but I'm still using the naive code which loads a hidden image (at the bottom). Even this amount of "magic" preloading really makes browsing the gallery quite fast as going to the next/previous image means usually only the image.php needs to be loaded.
At the end of image.php, I just have the following ("hidden" is a CSS class for display:noone)...
`
`
yep, sounds good. I've decided that i will load all of the following on every page:
-the next two pics
-the previous pic
-all the thumbs for the album (since i display all the image thumbs via rollover on every image page)
it's working pretty well now i think.