Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => SMF Feedback and Discussion => Topic started by: faraz_k86 on August 26, 2007, 03:29:24 AM

Title: unique feature of thantos, i want it :)
Post by: faraz_k86 on August 26, 2007, 03:29:24 AM
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 ??
Title: Re: unique feature of thantos, i want it :)
Post by: Gary on August 26, 2007, 04:28:18 AM
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
Title: Re: unique feature of thantos, i want it :)
Post by: SlammedDime on August 26, 2007, 04:29:11 AM
/me has that too.... :)
Title: Re: unique feature of thantos, i want it :)
Post by: faraz_k86 on August 26, 2007, 05:07:51 AM
k then slammedDime plz help me out here. how'd u do it
Title: Re: unique feature of thantos, i want it :)
Post by: SlammedDime on August 26, 2007, 01:36:18 PM
You'll need to create two files:
.htaccess
avatar.jpg

In .htaccess, put the following:
Code (.htaccess) Select
AddType application/x-httpd-php .jpg

in avatar.jpg, put the following:
Code (avatar.jpg) Select
<?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.
Title: Re: unique feature of thantos, i want it :)
Post by: H on August 26, 2007, 02:25:22 PM
I have one also although my one also has caching so I use less bandwidth :)