473,378 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Image display that will change for every 5 sec.

Hi all,

can any one come up with the code that display the images from the
folder.but image should be changed for every 5 seconds.can any one com
with this code. or suggest me the way to do it.quick reply will be
appreciated.

thanks in Advance.

Sep 30 '05 #1
1 3332
Faree wrote:
Hi all,

can any one come up with the code that display the images from the
folder.but image should be changed for every 5 seconds.can any one com
with this code. or suggest me the way to do it.quick reply will be
appreciated.

thanks in Advance.


Hi,

I think the most simple approach is a combination with Javascript and PHP.
Try something like this:
1) scan your directory with images
2) produce html that contains the javascript to loop over the images.

You'll end up with something like this:
(not tested, just some code to get you going)

<html>
<head>
<script type="text/javascript">

// fill the array imagenames from PHP
// by scanning the filenames in the directory.
// Have a look at: http://nl2.php.net/manual/en/function.readdir.php
// for some examplecode

var imagenames = ["mrJoe.jpg" , "ZaphodBreeblebrox.gif", "Marvin.png"];
var baseImageURL = "http://www.yoursite.com/images/";
var imgcount = -1;
var nrOfImages = imagenames.length;
nextimage();

function nextImage(){
imgcount++;
if(imgcount > nrOfImages) {
imgcount = 0;
}
// make full URL to image
var newImageSrc = baseImageURL + imagenames[imgcount];
// set the new Image
document.images.myImage.src=newImageSrc;
// Come back here in 5 seconds
setTimeout("nextImage()" , 5000);
}
</script>

</head>
<body>
<img scr="" name="myImage">
</body>
</html>

Good luck.

Regards,
Erwin Moller
Sep 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ken | last post by:
How does IE6 control the display of images? I change the content of a image file image1.jpg without changing the file name. Then jump to a new page to display it. IE6 does not displays the...
21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
6
by: Ben | last post by:
I am trying to write codes in VB.net to display 3 images in series on a Webform with each image being displayed in the same box for 5 seconds. I am trying to use Timer and image button, don't...
7
by: kebalex | last post by:
Hi, I have an app (written in .NET 2.0) which updates a picturebox according to some user input (a slider control). when the user makes a change i loop through all of the pixels, do a...
4
by: Deere | last post by:
When I try to take a database field and change it with a function and return it...it will not display the image. The "Imageurl" does not convert to "src=" but stays as ImageUrl. id=Image2 will...
7
by: fredo | last post by:
I've studied Eric Meyer's pure css popups, version two: http://meyerweb.com/eric/css/edge/popups/demo2.html which pops up an image when I roll over a text link. Now I want to pop up a large...
3
by: bbrewder | last post by:
I am interested in hearing how other people have handled sharing resources in multiple projects (for example, a save icon). We have a product that has many forms within many projects. Many of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.