Sig / Image rotator

save this file to your computer.

create a directory on your webserver named "rotator.jpg" ( with the .jpg extension ) and upload the index.php to it. Also add any images you want to be in the rotator.

then use BBcode or HTML to link to http://yoursite.com/rotator.jpg

[*IMG]http://yoursite.com/rotator.jpg[/IMG*] (no *)
<*IMG src=http://yoursite.com/rotator.jpg>

index.php code :

[PHP]
// This script randomly selects and displays images from the current directory
// It is a stripped-down version of the Automatic Image Rotator script by Dan P. Benjamin.

// Set image filename extensions
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';

// Get contents of current directory
$fileList = array();
$handle = opendir("./");
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) {
$fileList[] = $file;
}
}
closedir($handle);

if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $fileList[$imageNumber];
}

if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
header ("Content-type: image/png");
$im = @imagecreate (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);
imagepng ($im);
imagedestroy($im);
}
}

?>
[/PHP]

Verileah 16 years ago
Fuckin' a, thank you!
ROzbeans 16 years ago
Billie said the F word.
Vex 16 years ago
lets announce this as a holiday
Adiene 16 years ago
LOL
Merreck 16 years ago
That's pretty dang cool. Thanks!
Lillaanya 14 years ago
Ohhh there it is. /humps vex
Vex 14 years ago
oh man, i meant to find the link for you but my brain totally collapsed. glad you found it!
Jetamio 14 years ago
Can you have more than 1 btw? I play on different servers, would prefer one for each if its possible. Just put that file in anything you want to rotate?
Wonder if it would work on magelo backgrounds...
Vex 14 years ago
it very well should.

and yes you can have multiples.

i have a tacsig.jpg and a rotator.jpg folders
shiyla 14 years ago
/cry what if you dont have your own server
Jetamio 14 years ago
No idea hun :S

I tried it with Magelo backgrounds but it didnt seem to work.
Wystro 12 years ago
Vex;53040
save this file to your computer.

create a directory on your webserver named "rotator.jpg" ( with the .jpg extension ) and upload the index.php to it. Also add any images you want to be in the rotator.

then use BBcode or HTML to link to http://yoursite.com/rotator.jpg

[*IMG]http://yoursite.com/rotator.jpg[/IMG*] (no *)
<*IMG src=http://yoursite.com/rotator.jpg>


I made a directory named "rotator.jpg" and loaded images into it, but it doesn't appear to be working. It may have something to do with the fact that I don't know what "upload the index.php to it" means. Is that important? What does it mean? Is it hard to do whatever it is?
ROzbeans 12 years ago
I forget how to do this. =x Vex knows!
pharren 12 years ago
Looks like when the website was upgraded, the link was removed from her post. I think the "save this file to your computer" had a link to the index.php file.
Vex 12 years ago
i'll repost it!