The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Yikes - do NOT DUMP THOSE ARRAYS to your page with a server side script... that is sheer nonsense. You will create a nice bloated page. If you must leave the names the same on the server - then at least put an array in a separate .js file - and set chaching so it is downloaded once (if you need version control use the folder).

A better solution is to RENAME the images on the server - im0, im2, im3, im4. If they are different file types then at most you can store or deliver a compact array with the file types only - and the rest of the file name can be automatically constructed by JS on your page...

Your number of requests should not be a big deal via AJAX - provided your slide show is operating at a reasonable speed. The issue will be having a reasonably fast loading page - which is why i recommend changing the file names if you can.

An alternative is to have the client be unaware of the file names at all. You will need to maintain some sort of a LIFO buffer or similar structure on the server with the images - keep track of ther order handed out (use a cursor or other variable in your HTTP request) - and then simply have the client make a request like "get next 10 images" or next 5 or whatever you want... whenever the slideShow gets within a range of the end of the images fetched in the last request.

In that case your client does not even need to know the file names it is requesting. Just return a JSON array of URLs to the images from the server.