Gamingforce Interactive Forums
85242 35212

Go Back   Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk
Register FAQ GFWiki Community Donate Arcade ChocoJournal Calendar

Notices

Welcome to the Exploding Garrmondo Weiner Interactive Swiss Army Penis.
GFF is a community of gaming and music enthusiasts. We have a team of dedicated moderators, constant member-organized activities, and plenty of custom features, including our unique journal system. If this is your first visit, be sure to check out the FAQ or our GFWiki. You will have to register before you can post. Membership is completely free (and gets rid of the pesky advertisement unit underneath this message).


Rotating Sig Images?
Reply
 
Thread Tools
Jurassic Park Chocolate Raptor
Reactor online.
Sensors online.
Weapons online.
All systems nominal.



Member 80

Level 56.91

Mar 2006


Reply With Quote
Old Dec 17, 2008, 11:57 PM Local time: Dec 17, 2008, 10:57 PM #1 of 18
Code:
<?php

$folder = '.';

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

$img = null;

if (substr($folder,-1) != '/') {
	$folder = $folder.'/';
}

if (isset($_GET['img'])) {
	$imageInfo = pathinfo($_GET['img']);
	if (
	    isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
        file_exists( $folder.$imageInfo['basename'] )
    ) {
		$img = $folder.$imageInfo['basename'];
	}
} else {
	$fileList = array();
	$handle = opendir($folder);
	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 = $folder.$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);
	}
}

?>
I can't remember where I got this, but I've had it for a while sitting in an old snippets folder. It works with [img] tags. I used it to host Paco's mexican joke sig from a while back.

Forgive me if it's patronizing but I'll be as beginner friendly as possible.

Copy, paste, throw into your favorite text editor, save with a .php extension.

Throw it into the folder full of the images you want to rotate on your host, and then go
[ img]http://www.crashlandon.com/sigs/rotatin/nameofscript.php[/img].

You can add more supported file types to the file type array as long as your mime-type is correct, and you can put this rotator script elsewhere if you change the $folder variable to point to the full path of the folder full of images you want to use.

Edit: See?



Jam it back in, in the dark.

Last edited by Jurassic Park Chocolate Raptor; Dec 18, 2008 at 12:11 AM. Reason: Added example
Reply


Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk > Rotating Sig Images?

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: How to enhance images for Avatar and Sig purposes Kairi Li The Creators' Cafe 9 Aug 15, 2008 07:36 PM
Some images in IE7 is shown as red X gaming Help Desk 2 Mar 11, 2008 01:45 AM
Favorite Prog For Creating CD Images? DeLorean Help Desk 8 May 23, 2007 02:15 PM


All times are GMT -5. The time now is 10:26 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2026, vBulletin Solutions, Inc.