News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

unique feature of thantos, i want it :)

Started by faraz_k86, August 26, 2007, 03:29:24 AM

Previous topic - Next topic

faraz_k86

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 ??

Gary

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
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

SlammedDime

SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

faraz_k86

k then slammedDime plz help me out here. how'd u do it

SlammedDime

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($ffilesize($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.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

H

I have one also although my one also has caching so I use less bandwidth :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Advertisement: