Sig Rotator

Posts 1–6 of 6 · Page 1 of 1
Sig Rotator
Enjoy Teh TuT
First off is you have to have a host that allows php. If you don't have one, I recommend signing up at ********. The only downside of them is that you have a 250 k file size limit. But if they're saved as gifs, that shouldn't be a problem.

1. Make a new directory. Name it something simple like sigs.

2. Upload all the images you want to use into the same directory.

3. Open word pad, and past this into it


Code:
<?php 

if ($dir = opendir(".")) 
{ 
$list = buildimagearray($dir); 
displayrandomimage($list); 
} 

// This function reads all the files in the current directory and adds all image files to the array $list[] 
function buildimagearray($dir) 
{ 
while (false !== ($file = readdir($dir))) 
{ 
if (!is_dir($file) && getimagesize($file)) 
{ 
$list[] = $file; 
} 
} 
return $list; 
} 

// This function selects a random image, determines the mime type, opens the file for reading, 
// and then outputs the image 
function displayrandomimage($list) 
{ 
srand ((double) microtime() * 10000000); 
$sig = array_rand ($list); 

$size = getimagesize ($list[$sig]); 
$fp = fopen($list[$sig], "rb"); 

if ($size && $fp) 
{ 
header("Content-type: {$size['mime']}"); 
fpassthru($fp); 
exit; 
} 
} 
?>


Save it as index.php.

4. Upload it into the directory with the images you uploaded before.

5. Now on the forum, the image tag should look like this.

CODE
[IMG]http.whereyouuploaded.com/sigs/index.php[/IMG]



That's it.
^_^ go ahead ill like to see ur result
I'll sticky this one. Seems very useful.
Yeah, I might use it in my gallery actually
When I try this it just shows nothing...
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us