One of my members at the Sonic Station recently reported that using an avatar rotator as an avatar URL doesn't work. It gives them an error about it not being a valid avatar URL. See below screenshot.
https://dl.dropbox.com/u/63404079/rotavafail.JPG
This is the script I use to rotate my avatars
<?php
/*******************************************************************************
* PHP AVATAR ROTATOR
* VERSION 2
*******************************************************************************/
$path = ""; // Path to your avatar folder relative to the root directory of your site
/******************************************************************************
* DO NOT EDIT BELOW THIS LINE!
******************************************************************************/
$dir = $_SERVER['DOCUMENT_ROOT'].$path;
$avatars = array();
// Open avatar directory and read its contents into an array
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir.$file) == "file" && getimagesize($dir.$file)) {
array_push($avatars, $file);
}
}
closedir($dh);
}
}
// Create random avatar
$img = $dir.$avatars[rand(0, count($avatars)-1)];
$info = getimagesize($img);
if ($info[2] == 2)
header('Content-Type: image/jpeg');
elseif ($info[2] == 3)
header('Content-Type: image/png');
else
header('Content-Type: image/gif');
readfile($img);
?>
I guess I should post on how to use
1. Turn script into a php file put in your root dir give it a name like rotator so you get rotator.php
2. fill in "$path = ""; // Path to your avatar folder relative to the root directory of your site" where avatars are located.
3. then
http://www.yoursite.whatever.rotator.php for your avatar url