<?php
// Directory goes here relative to script (fs = file system; ws = web server directory)
$image_fs_dir = '/absolute/path/to/images'; // without trailing slash
$image_ws_dir = '/web/path/to/images/'; // with trailing slash
$href_link = '[URL unfurl="true"]http://www.ironorchid.com/clipart/';[/URL] // What your link points to (optional)
$handle = opendir($image_fs_dir);
while (false !== ($file = readdir($handle))) {
if (preg_match("/\.(jpe?g|gif|png)$/i", $file)) {
$filelist[] = $file;
}
}
closedir ($handle);
srand((double)microtime()*1000000);
$picnum = rand(0, sizeof($filelist) - 1);
$content = '<div align="center">';
if ($href_link != '') {
$content .= '<a href="' . $href_link . '"><img src="' . $image_ws_dir . $filelist[$picnum] . '" border=0></a>';
} else {
$content .= '<img src="' . $image_ws_dir . $filelist[$picnum] . '" border=0>';
}
$content .= '</div>';
?>