I have the script below that works if you were to go to http://www.umcswtx.org/random.php
For the life of me, I cannot figure out how to put it in an html page.
I want random images and cutlines on refresh on this page
http://www.umcwtx.org
url correction
http://www.umcswtx.org
As usual, it will be something small that I need to do, but I can't find it.
Please , if anyone can direct me..
Appreciate it.
<?php
$path = './Images/';
$files=array();
if ($handle=opendir("$path")) {
while(false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
substr($file,-3)=='gif';
substr($file,-3)=='jpg';
substr($file,-3)=='jpeg';
substr($file,-3)=='png';
$files[count($files)] = $file;
}
}
}
closedir($handle);
$random=rand(0,count($files)-1);
if(substr($files[$random],-3)=='gif') header("Content-type: image/gif");
elseif(substr($files[$random],-3)=='jpg') header("Content-type: image/jpeg");
elseif(substr($files[$random],-3)=='jpeg') header("Content-type: image/jpeg");
elseif(substr($files[$random],-3)=='png') header("Content-type: image/png");
readfile("$path/$files[$random]");
?>