New image every 24 hours / or every hour? |
New image every 24 hours / or every hour? |
dsmith916 |
Nov 23 2013, 07:20 AM
Post
#1
|
Advanced Member Group: Members Posts: 162 Joined: 5-December 12 Member No.: 18,203 |
Hi. I'd like to have an image on my site that changes to a different image from a directory on my server every day, or once every hour. How do I go about doing this? I haven't found anything promising from any google searches
|
pandy |
Nov 23 2013, 09:35 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
It won't happen with HTML, but you could do it with JavaScript.
Get the user's time. If it's past 00 show image X. If it's past 01 show image Y and so forth. http://www.google.com/search?q=javascript+...image+each+hour |
dsmith916 |
Nov 24 2013, 06:36 AM
Post
#3
|
Advanced Member Group: Members Posts: 162 Joined: 5-December 12 Member No.: 18,203 |
It won't happen with HTML, but you could do it with JavaScript. Get the user's time. If it's past 00 show image X. If it's past 01 show image Y and so forth. http://www.google.com/search?q=javascript+...image+each+hour There a lot of different methods and I'm not sure exactly what to do with all of them. What can I do to get x number of files in folder duncansphotos.com/profileimages/ to change at midnight every night and repeat at the end? I just want to be able to add photos to this folder and have them show up at the end of the list. I also need to scale all the images src to width 200 |
Christian J |
Nov 24 2013, 09:25 AM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
I'd like to have an image on my site that changes to a different image from a directory on my server every day, or once every hour. How is that question different from http://forums.htmlhelp.com/index.php?s=&am...ost&p=78795 ? QUOTE I also need to scale all the images src to width 200 Do you mean the image files or the IMG element? |
pandy |
Nov 24 2013, 12:18 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
QUOTE I just want to be able to add photos to this folder and have them show up at the end of the list. In that case you need to do it server side. http://www.google.com/search?q=php+new+image+each+hour and so forth. |
dsmith916 |
Nov 24 2013, 02:36 PM
Post
#6
|
Advanced Member Group: Members Posts: 162 Joined: 5-December 12 Member No.: 18,203 |
I'd like to have an image on my site that changes to a different image from a directory on my server every day, or once every hour. How is that question different from http://forums.htmlhelp.com/index.php?s=&am...ost&p=78795 ? It's slightly different. And I had lost that thread. QUOTE I also need to scale all the images src to width 200 Do you mean the image files or the IMG element? 1) I want to scale the image elements to width 200 on the page they end up on. 2) I want 1.php to show up one day followed by 2.php the next day and repeat when it reaches the end. 3) I want to be able to add php files to the directory (example 8.php) and have the script automatically include that file in the rotation without modifying the script in any way after I add the file(s) 4) files must change at midnight This post has been edited by dsmith916: Nov 24 2013, 02:38 PM |
Christian J |
Nov 24 2013, 05:49 PM
Post
#7
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
1) I want to scale the image elements to width 200 on the page they end up on. Just give the IMG element a width, but leave out the height (that way the image keeps its proportions). But it's best to do all resizing in the image files themselves. QUOTE 2) I want 1.php to show up one day followed by 2.php the next day and repeat when it reaches the end. 3) I want to be able to add php files to the directory (example 8.php) and have the script automatically include that file in the rotation without modifying the script in any way after I add the file(s) Get the day of month with date() --see the PHP manual for details. Get the number of files in a directory with scandir() and count(). Make the script cycle files with the modulus operator (that's the tricky part IMO, see if Brian's code examples in the other thread can help you). QUOTE 4) files must change at midnight That's what the floor() function is for. |
Lo-Fi Version | Time is now: 23rd April 2024 - 03:59 PM |