|
|
|
|
![]() ![]() |
| jpsimboy |
Nov 22 2004, 12:02 AM
Post
#1
|
|
Guests |
Im looking for a script or some code that randomly picks an image from a specifed folder and displays it in a block. Is there a scirpt or code i can use to do this?
|
|
|
|
| discovertrip |
Nov 24 2004, 12:20 PM
Post
#2
|
|
Guests |
Hello jpsimboy :wink:
here is the source for you... randompic.php CODE <?php
// folder directory which contains images files $folder="randompic/"; $openfold=opendir($folder); while($files=readdir($openfold)) { // put file names into a table if(is_file($folder.$files)) $tabjpg[]=$files; } srand ((double) microtime() * 10000000); $rand_keys = array_rand ($tabjpg); echo "<img src="".$folder.$tabjpg[$rand_keys]."" alt="".$tabjpg[$rand_keys]."">"; ?> ============================== /* How TO use this script; Example: just put <?php include('randompic.php'); ?> */ Voila,,, Enjoy and Have a nice day Anan. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 08:37 PM |