Displaying one image at a time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mo
Forum Newbie
Posts: 21
Joined: Thu Nov 06, 2003 7:21 am

Displaying one image at a time

Post by Mo »

I want to display a few images on the screen - 1 at a time.

Meaning:
display the first image
wait one second
display the second image
wait one second
display the third image

Code: Select all

<?php
echo "<img src='image_1' width=320 height=240>";
flush(); sleep(1);

echo "<img src='image_2' width=320 height=240>";
flush(); sleep(1);

echo "<img src='image_3' width=320 height=240>";
flush(); sleep(1);
?>
I dont think this is the best way to do this. One thing I notice is the mouse hase the hourglass symbol, like the page is still loading.

Does anyone have any suggestions.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Displaying one image at a time

Post by Weirdan »

Mo wrote: I dont think this is the best way to do this. One thing I notice is the mouse hase the hourglass symbol, like the page is still loading.

Does anyone have any suggestions.
Better way is to use JS. Preload desired images, then use settimeout function to change image source.
Mo
Forum Newbie
Posts: 21
Joined: Thu Nov 06, 2003 7:21 am

Post by Mo »

I am not familioar with javascript. Could you give me an example?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

http://www.hotscripts.com might have that code.

If not a [google]google[/google] search will most likely help ya.
Post Reply