Jpegs won't download in the order they're listed
Here's a problem that has me puzzled--
When I create a photo gallery of say 12 jpegs, I like to display them all on one page since each jpeg is only about 30kb (384x256). This works great even on a slow connection, because while the surfer is admiring the 1st couple images, the other ones are downloading beneath the fold; so when he scrolls to the next couple images, they've had time to download so he doesn't have to wait for them.
OK, here's the problem: The jpegs don't always download & display in the SAME ORDER that's listed in the html file. Sometimes I have them in a large table with several cells; other times I DON'T use tables and just have them all listed with IMG tags inside the body. But the problem still occurs, and there's nothing else happening on the page--just plain HTML.
So... A surfer might see the 1st image, then perhaps sit there waiting for the 2nd image to display, while simultaneously, ALL THE OTHER jpegs are displaying beneath the fold, and the damn 2nd jpeg on Top of the page only displays after most of the others are done.
This happens sporadically; it's usually unpredictable as to which image may download "out of turn." Although sometimes I've noticed a pattern.
I'd be very appreciative of any help that would keep my layout scheme intact. I ususally use tables, but as I said, this problem occurs even on occasions when I don't use them.
--Papa
Abhishek Reddy posted this at 03:51 — 16th July 2001.
He has: 3,348 posts
Joined: Jul 2001
hi PaPa,
my guess is that it happens because thats the way the browser works. what browser do you use?
im not sure exactly what you can do about it. try preloading the images in the order you want.
<script>
var imgXYZ = new Image()
imgXYZ = "/folder/xyz.jpg"
</script>
change the var names, locations etc. and repeat those lines of code as needed, in the order you want.
i doubt theres much else....also, could you post what pattern you noticed...it may help.
PaPa posted this at 14:58 — 16th July 2001.
They have: 15 posts
Joined: Jul 2001
Abhishek--
Thanks for the reply. It seems to happen on both IE & NS.
As far as a pattern, I notice that sometimes, say the 3rd jpeg will get stuck loading more often than not. And then on another gallery page, maybe its the 6th jpeg that seems to get stuck. But it's still rather a random event.
I'm just starting to learn javascript, so I'll try your suggestion when I'm up to speed.
--Papa
AndyB posted this at 02:49 — 17th July 2001.
They have: 344 posts
Joined: Aug 1999
Actually, nothing downloads in the order it's listed. The http requests are issued in the order listed but once an http request is issued (almost) anything can happen at the server end or while any of the request/data packets are moving through the Internet.
You can't control it, and it's not worth worrying about.
BTW a page with 12 pictures each 30kb would drive away anyone using a 28.8 modem. Thumbnail images linked to larger versions in a pop-up or separate window is a much friendlier way to go.
taff posted this at 14:48 — 18th July 2001.
They have: 956 posts
Joined: Jun 2001
Andy is completely right. Preloading may speed up the process but will not do anything about the order.
Trust me on this one, I went through the exact same thing on a recent, rather largish photographer portfolio. The client was insisting that the images appear in sequence. It was quite a battle to convince him that it was beyond my control.
.....
detox posted this at 15:20 — 18th July 2001.
They have: 571 posts
Joined: Feb 2001
You could take a leaf out of a couple of preloading scripts that return TRUE when the images are loaded, this could be done for each separate image, thus giving you control over the order of downloading. Only one small problem would get in the way of this. the waiting time; people simply don't have the patience.
What the others are saying is true. If you have to wait for a 12 image page to download over a slow connection, unless you have the patience of a god, you wont wait around.....
PaPa posted this at 17:45 — 21st July 2001.
They have: 15 posts
Joined: Jul 2001
Thanks for the information!
Very enlightening!
--Papa
Abhishek Reddy posted this at 00:48 — 22nd July 2001.
He has: 3,348 posts
Joined: Jul 2001
hey,
sorry for replying so late....but an idea struck me only now.
looks to me like you may do well using a slideshow.
the viewer views one image at a time, so no matter what they only get to see it in the order you put them.
PaPa posted this at 22:03 — 22nd July 2001.
They have: 15 posts
Joined: Jul 2001
Abhishek,
Thanks for the suggestion. I have been thinking about using a "slide show" for certain situations. I especially like the sites I've seen that have the "page turning" effect.
A few sites I've seen have done the slide show using PowerPoint; most others have done it using JavaScript.
Thanks again,
Papa
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.