Jump to content
xisto Community
Sign in to follow this  
iGuest

Random Pic block for nuke

Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.