Simply place the first main php code into image.php then enter the last two code lines into a .htaccess file! Put images into the right directory, change the locations where needed and voila! The image will change every time you refresh.
This is my first PHP snippet on Hawkee so please give constructive criticism!
##Random Image PHP Snippet##
##By [M]ike - For Hawkee.com##
##Create image.php and put this into it##
<?php
header("Content-type: image/png");
$avatars[] = "images/1.png";
$avatars[] = "images/2.png";
$avatars[] = "images/3.png";
$avatars[] = "images/4.png";
$avatars[] = "images/5.png";
$avatar = $avatars[mt_rand(0, count($avatars)-1)];
$newavatar = imagecreatefrompng($avatar);
imagepng($newavatar);
imagedestroy($newavatar);
?>
##Now create a .htaccess file and put this into it##
RewriteEngine On
RewriteRule image.png image.php
##Now your done!##