Jump to content

Guide to Setting up a Random Sig Script (not uzzisoft)


Mercifull

Recommended Posts

This post will explain how to set up your own random image script using your own webspace with your isp, some free hosts or real webhost.

 

 

 

 

 

 

 

Step 1: Create the code. The following is basic php code which will create a random image script. Save this file as rand.jpeg

 

 

 

<?php 



////////////////////////////////////////////////////////////////////// 



/*                  Matt Sims' PHP Sig Rotator V1.3                 */ 



/*                                                                  */ 



/* This script takes an inventory of all image files in a directory */ 



/* and displays one at random. All you need to do is save this code */ 



/* in a directory that contains your images (name it what you will, */ 



/* but make sure it has a ".php" extension). Then just link to this */ 



/* script to get your random image.                                 */ 



/*                                                                  */ 



/* I would recommend naming this file "index.php," and then you can */ 



/* just link to the directory itself (like I do in my example).     */ 



/*                                                                  */ 



/* [email protected]                                            */ 



/* www.evilmerc.com                                                 */ 



////////////////////////////////////////////////////////////////////// 







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 the file and upload to your webspace.

 

 

 

 

 

 

 

Step 2: You will need to create a file to make the webser parse .jpeg files as php in order to get the script to work rather than displaying random characters of code.

 

 

 

Create a file called htaccess.txt and paste the following code.

 

 

 

AddType application/x-httpd-php jpeg

Again upload to your webspace but you must then rename the file as .htaccess (thats dot htaccess with nothing before the ".")

 

 

 

You will then get a working image like the one at http://avatar.evilmerc.com/lil/rand.jpeg

 

 

 

 

 

 

 

Step 3: Create the image listing page. To make a page showing all the images in the directory like the one on this page. Use the code found here

 

 

 

In my example I have it saved as show.php but you could save it as index.php so that people see the image list when they type your image path directory.

 

 

 

 

 

 

 

Optional: If you want you could also add an image upload script such as the one I use on Woo Yay! You can view the code I use on that site here.

 

 

 

 

 

 

 

How it looks:

 

 

 

 

 

 

 

rand.jpeg

 

 

 

There are currently 29 images in my sig.

 

 

 

Click here to see them all!

 

 

 

 

 

 

 

And in BBCode format:

 

 

 

[img=http://avatar.evilmerc.com/lil/rand.jpeg]



There are currently [u]29[/u] images in my sig.



Click [url=http://avatar.evilmerc.com/lil/show.php]here[/url] to see them all!

 

 

 

Keywords: Random sig script image php code htaccess rotator mercifull

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Link to comment
Share on other sites

  • 4 months later...

With Uzzisoft fubared right now people might actually use this script i wrote lol. :D

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Link to comment
Share on other sites

With Uzzisoft fubared right now people might actually use this script i wrote lol. :D

 

 

 

 

 

 

 

Any clue how much bandwidth it would eat up? I'm not really concerned I'd just like to know. Tip.it is quite large so I'm sure the sigs are viewed a lot of times..

Link to comment
Share on other sites

Well ive currently served 132.57 Meg this month on http://www.woo-yay.net (where my current sig is hosted) but most of that is from all the other images ive got hosted there. I guess you need to just see how it goes. Ive no idea how much b/w gets used up from tipit sigs alone, depends how much u post i guess.

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Link to comment
Share on other sites

Might give it a try, but what exactly happened to Uzzisoft?

 

 

 

 

 

 

 

Edit: Found out that the site is working again :)

 

 

 

 

 

 

 

Yeah its back working now, i bumped this topic because i thought it might be useful to ppeople. I didnt know how long uzzisoft would be down for

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.