PHPBuilder - Random Sig picture

RSS Twitter
Snippets Other

Random Sig picture

by: Chris
January 30, 2005

Version: 1.0

Type: Full Script

Category: Other

License: GNU General Public License

Description: Use this code on forums that allow you to have a picture in you sig.

Rotating Sig Tutorial
Written By Demosthenes705

This tutorial will show you how to make a sig rotator.

You will need:
- All sigs that you want to include in .PNG format.
- A webserver that supports PHP.

Step 1
Get all the sigs that you want to be included into one folder. Make sure that they are all .PNG files.

Step 2
Rename the images in numbered order. The order doesn't matter, as it rotates randomly and not in any order. For example: 0.png, 1.png, 2.png, etc...

Step 3
Open any text editor that you like. For example: notepad. Paste the following code into that file and edit what is needed.

PHP Code:
// ======================= //
// Follow the instructions to edit the information below this line.
// ======================= //

// Set the range of images you have here. For example: $img_num = rand(0,10) 0 would be the first image in the set, and 10 would be the last image
$img_num = rand(1,8);

// ======================= //
// ======================= //
// You need this to make sure that browsers read this as an image
header("Content-type: image/png");

// Get a file into an array.
$lines = file($img_num . ".png");

// Loop through our array to show the image.
foreach ($lines as $line) {
   echo $line;

Step 4
Save that file as 'sig.php' without the quotes. Save it in the same folder as the images.

Step 5
Upload that folder to your webserver.

Step 6
Use the location of the sig.php file in an image tag just like a regular image. For example:
HTML Code:


You're done!!!

Unless you know what you are doing don't edit. if you do you can change the image type that will be displayed by chaning these lines

PHP code:
header("Content-type: image/???");

and then this line

$lines = file($img_num . ".???");

Thats all and just use the tag in step 6 and it will work

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.