Support Forums

Full Version: Changing avatar script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Found it on the net,just wanted to share

PHP Code:
<?php
/*
How to use:
1. Place suitable images in the same folder as the script resides.
The images should have a .jpg, .gif or a .png ending.

2. Copy the source of this script in a textfile, rename it avatar.php
(or any other name, as you please) and save it in the same directory as the images.

3. Call the script by appending a random name with the filetype ending.
Example:
http://www.fungifun.org/rotate/avatar.php/example.jpg

avatar.php is the name of the script

example.jpg is a random name, you could also use asasd.jpg or qwfpoa.jpg, the name doesn't matter,
what is important is the ending. The ending determines which files from the folder are used.
So, if you use example.gif, then the gif files in this folder will be used.
*/

$filetype end(explode(".",$_SERVER['REQUEST_URI']));
if(
$filetype != "jpg" && $filetype != "gif" && $filetype != "png") exit;
if (
$handle opendir('.')) {
   while (
false !== ($file readdir($handle))) {
       if (
$file != "." && $file != ".." && stristr($file".".$filetype)) $files[]=$file;
   }
   
closedir($handle);
}
if (
$files) {
    
$imagenr rand(0sizeof($files)-1);
    if(
$filetype == "jpg"$filetype "jpeg";
    
$fp fopen($files[$imagenr], 'rb');
    
header("Content-Type: image/$filetype");
    
header("Content-Length: " filesize($files[$imagenr]));
    
fpassthru($fp);
    exit;
}
?>
This is in one point better than mine, it doesn't require GD installed on the Server, nice find!
Thanks man, it's a really useful script. I'm using it now.
what does it do?
(04-05-2010, 01:30 PM)burnt Wrote: [ -> ]what does it do?

It changes your avatar.

You create a folder, upload the images you want, and it rotates through them.
Sheet, really cool script. Thanks for release!
(04-05-2010, 01:31 PM)Drake™ Wrote: [ -> ]It changes your avatar.

You create a folder, upload the images you want, and it rotates through them.

my signature randomizer, and master of the universe's both do the same thing too ^^
the signatures can be exchanged with avatars to do the avatars, or with master of the universes you can resize all the images to avatar size since his has so many cool functions
(04-05-2010, 02:21 PM)Nyx- Wrote: [ -> ]my signature randomizer, and master of the universe's both do the same thing too ^^
the signatures can be exchanged with avatars to do the avatars, or with master of the universes you can resize all the images to avatar size since his has so many cool functions

So, would it work on HF? Like:

Code:
[img]www.mydomain.com/images/random-sig.php[/img]

?
(04-05-2010, 02:24 PM)Drake™ Wrote: [ -> ]So, would it work on HF? Like:

Code:
[img]www.mydomain.com/images/random-sig.php[/img]

?

for your signature yeah, for the avatar you have to redirect the URL so its .jpg not .php then just use it remotely.
(04-05-2010, 02:31 PM)Nyx- Wrote: [ -> ]for your signature yeah, for the avatar you have to redirect the URL so its .jpg not .php then just use it remotely.

Ok, thanks for your help dude. Victoire
Pages: 1 2