Support Forums
Changing avatar script - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Changing avatar script (/showthread.php?tid=3767)

Pages: 1 2


Changing avatar script - Brainless Control - 12-19-2009

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



RE: Changing avatar script - Gaijin - 01-14-2010

This is in one point better than mine, it doesn't require GD installed on the Server, nice find!


RE: Changing avatar script - Drake™ - 04-05-2010

Thanks man, it's a really useful script. I'm using it now.


RE: Changing avatar script - burnt - 04-05-2010

what does it do?


RE: Changing avatar script - Drake™ - 04-05-2010

(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.


RE: Changing avatar script - Support - 04-05-2010

Sheet, really cool script. Thanks for release!


RE: Changing avatar script - Nyx- - 04-05-2010

(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


RE: Changing avatar script - Drake™ - 04-05-2010

(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]

?


RE: Changing avatar script - Nyx- - 04-05-2010

(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.


RE: Changing avatar script - Drake™ - 04-05-2010

(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