iGuest 3 Report post Posted November 22, 2004 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? Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 24, 2004 Hello jpsimboy :wink: here is the source for you...randompic.php <?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. Share this post Link to post Share on other sites