View Full Version : 'Rotating' graphic seems to be causing overbandwidth - solutions?
msealey
08-24-2008, 02:12 AM
Hello,
I have a site with graphics rotating using JavaScript - examples at:
<http://www.ladesignconcepts.com/index.html> and <http://www.ladesignconcepts.com/about.html>
But oughtn't users' browsers to be cacheing the graphic such that the second time each one is requested, it gets displayed from their cache?
Isn't there a way to force that to happen rather than have this huge bandwidth overhead b/c each graphic keeps getting requested repeatedly?
TIA!
:umm:
Tom E.
08-24-2008, 03:01 AM
My guess is that your preLoad1[] array is really a re-load.
I think you want to execute this line once for each value of nss:
preLoad1[nss].src = myimages1[nss];
but your runSlideShow() function executes it again and again, even if it has been executed before for a given value of nss.
Once preLoad1[nss].src has been set once for each value of nss, all you want to do is use the value in this line:document.images.rImage.src = preLoad1[nss].src; each time the slide changes.
It's late and I just drove back from New Hampshire, so I hope this makes sense.
msealey
08-24-2008, 03:32 PM
Thanks, Tom, very much for taking the time and trouble to look at my JavaScript! That's much appreciated :-)
I confess it's ages since I adapted that and can't now remember exactly how it works.
I couldn't prevail upon you to explain in a little more detail, could I, just how this should be changed, could I - if necessary via PM or email?
Thanks :-)
kitchin
08-24-2008, 04:02 PM
Try changing
preLoad1[nss].src = myimages1[nss];
to
if (!preLoad1[nss].src) preLoad1[nss].src = myimages1[nss];
That would be the first thing I would try, but your mileage may vary, as they say. I read all the code down to that line.
msealey
08-24-2008, 05:49 PM
kitchin,
How kind of you!
Have done that. I'll wait and see if it causes the effect you think it might. Again, much appreciated :-)
kitchin
08-24-2008, 07:15 PM
You test it out by looking at your logs.
msealey
08-24-2008, 07:50 PM
Looking at the logs should show that each graphic is being requested fewer times (than before), Yes?
Arthur
08-25-2008, 09:56 AM
Mark, out of curiosity I analyzed your logs for this month and it shows that 80% of the server responses to requests for images from /img/rotate/ is a 304 (Not Modified, or in other words, the browser loaded it from its cache).
If you divide the data transfer for that directory by the number of visitors, you get about 1.6 MB. So, on average each visitor transfers 1.6 MB when they hit a page with rotating images.
IMO, optimizing the images and/or reducing the number of images is the best route towards reducing the bandwidth usage.
-Arthur
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.