Jump to content

PHP Image rotation based on time - minutes


frquency

Recommended Posts

Hello,

I am wondering if anyone can help me here, im looking for some info on where to start with this:

 

I would like to know how I can display a different image based on the time of day perticulary minutes.

 

for example user visits page at 12:02 and gets images "1202.jpg" but if visits at "12:32" they will get the image "1232.jpg"

 

I have seen this done to display radio station DJ's but this was by the hour.

 

Thanks

Link to comment
Share on other sites

I can see this being done with 3 images.

1) Blank clock face

2) Hour hand (everything else transparent)

3) Minute hand. (everything else transparent)

 

Then its just a matter of using the GD image library and rotating the hour and minute images to the correct time.

Link to comment
Share on other sites

I would like to know how I can display a different image based on the time of day perticulary minutes.

for example user visits page at 12:02 and gets images "1202.jpg" but if visits at "12:32" they will get the image "1232.jpg"

Thats how I took this statement...seems like a clock to me?

Link to comment
Share on other sites

What you are looking for is a combination of php/java/html.

Add

<META HTTP-EQUIV="refresh" CONTENT="15">

 

inside the <head></head> and then add a script in either php or java, whatever flavor you like, to get a timestamp, and run it thru a switch().  Or you can have just a random image from an array loaded.

 

something like:

<?php

$Picture_array = array("image1.jpg","image2.jpg","image3.jpg","image4.jpg");

$Randomnumber= rand(1,4);
$picture = $Picture_array[$Randomnumber];

?>
<html>
<head>
<meta http-eqiv="refresh" content = "60" >
</head>
<body>
<image src="<?php echo $picture; ?>" width=180 height=180>
</body>
</html>

 

Link to comment
Share on other sites

What you are looking for is a combination of php/java/html.

 

Java is not javascript. They are very different languages.

 

<META HTTP-EQUIV="refresh" CONTENT="15">

 

This isn't a good way to do refreshes - search engines don't like it. The preferred method is:

 

header ('Refresh: 3; url=index.html');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.