http://emoruffino.com and thought i'd share it...
Author: BRANDON HEYER
1. Make a php file named: basic_image_randomizer.php
2. put this into the file:
CODE
<?
$GLB_IMAGE;
function imageRandom($dir, $types) {
$images = array();
$new = array();
global $GLB_IMAGE;
if ( !empty($types) ) {
$types = explode(",", $types);
foreach ( $types as $t ) {
$glob = $dir . '*.' . $t;
$new = glob( $glob );
if ( !empty( $new ) ) {
$images = (array)$new + (array)$images;
}
}
} else {
$images = glob( $dir . '*.*' );
}
$key = array_rand($images);
$image = $images[$key];
$GLB_IMAGE = $image;
echo $image;
}
?>
$GLB_IMAGE;
function imageRandom($dir, $types) {
$images = array();
$new = array();
global $GLB_IMAGE;
if ( !empty($types) ) {
$types = explode(",", $types);
foreach ( $types as $t ) {
$glob = $dir . '*.' . $t;
$new = glob( $glob );
if ( !empty( $new ) ) {
$images = (array)$new + (array)$images;
}
}
} else {
$images = glob( $dir . '*.*' );
}
$key = array_rand($images);
$image = $images[$key];
$GLB_IMAGE = $image;
echo $image;
}
?>
3. Add this to the top of your page (anywhere really)
CODE
<? include("basic_image_randomizer.php"); ?>
4. Enter this code into your page and your done.
CODE
<img src='/<? imageRandom('random/', 'png,jpg'); ?>' />
Were it says random you can put in any directory that has your images. And you can also make it just PNG or JPG or GIF by adding it into coding.

