OK, so I had to try this out. If this forum didn't check headers when you try and submit a URL to an image, this would work. I send it Content-Type: image/jpeg but some of the apache specific headers get written first and this forum rejects the URL even though I used
<Files "/icon.jpg">
ForceType application/x-httpd-php
</Files>
in my .htaccess file. Anyways, here's the code. You can try it in other forums and see if it works for you.
My php file (/icon.jpg):
<?php
define("ICON_PATH", $_SERVER['DOCUMENT_ROOT']."/icons/");
header( "Content-Type: image/jpeg" );
$dh = opendir(ICON_PATH);
$files = array();
while (false !== ($filename = readdir($dh))) {
if ( strpos(strtolower($filename), ".jpg") !== false ) {
$files[] = $filename;
}
}
$randomkey = array_rand($files);
$im = imagecreatefromjpeg(ICON_PATH . $files[$randomkey]);
imagejpeg($im);
?>