hello,
while browsing the forum i noticed that one of the developers of sms, thantos , has a very nice option: every time the page is refreshed his avatar changes, thats like a single user has a lot of avatars, is there aby way i can get this activated on my forum ??
Any user can have a random avatar display, provided you have the right script.
It's somewhere on these forums though I forget where... :P
-ALM
/me has that too.... :)
k then slammedDime plz help me out here. how'd u do it
You'll need to create two files:
.htaccess
avatar.jpg
In .htaccess, put the following:
AddType application/x-httpd-php .jpg
in avatar.jpg, put the following:
<?php $dp=opendir("."); while ($file=readdir($dp)) { if (substr($file,0,1) != "." && $file != "avatar.jpg") $files[]=$file; } closedir($dp); sort($files); $filename=$files[rand(0,count($files)-1)]; $f = fopen($filename, "r"); $contents = fread($f, filesize($filename)); fclose($f); header("Content-Type: image/jpeg"); print($contents);?>
Then put those two files in a directory along with any JPEG files you want to rotate, and then navigate your browser to avatar.jpg, and you should see a randomly selected image.
I have one also although my one also has caching so I use less bandwidth :)