0

I want to create a slideshow of images. Image files will be uploaded from harddisk to the browser and change each other at specified duration.
How can i generate delay (after which the next image will be uploaded ) ?
Thank you in advance

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by Puckdropper
0

This would involve javascript rather than php.

What you would have to do is use JavaScript to first preload the images, so that there is not delay when the image slides to the next.
This is done by attaching an onload event handler to the window object.
IE: window.onload = function() { /* js preload images goes here */ };

Switching through images is a simple matter. Changing the source of an image will make the browser load a new image in replacement of the old one.
IE: img.src = 'http://example.com/images/newimage.gif";

Maybe the JS forum would help or you can try google for "JavaScript Image Slideshow" or something similar. :)

0

You could do an annoyingly crude version in PHP using header commands. Tell the browser to refresh every x seconds (I think it's header(refresh: 10, http://www.yoursite.com)) and on each refresh change the reference URL.

This reloads the whole page rather than just the image, so a client-side language like JS is probably your best bet.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.