View Single Post
Old 05-21-2005, 12:48 AM
Incongruity Offline
Join Date: Mar 2005
Location: Providence, Rhode Island
Posts: 1,332
Send a message via AIM to Incongruity Send a message via MSN to Incongruity Send a message via Yahoo to Incongruity
Default Re: How to be a trend*****

Some veterans of making sigs might remember a wonderful place known as Redutopia. Unfortunately, too much bandwith was being used, so the owner shut it down (but being the nice guy he is, he let people retrieve their sigs AND gave out the source; however, we'll be using a different source). These were very popular, even after he shut the site down, as they were relatively easy to use


Step 1. Find a website host. It must be able to handle php, and make sure it doesn't have too many limitations. Anglefire/geocities/that kind of thing is bad. I personally am using and I am loving it

Step 2. Open up notepad. I am REALLY sorry that I do not remember where I obtained this source. If someone tells me, or I find out who, I will add credit immediately Copy and Paste the following source into notepad


        What to do:

        1. Modify the $folder setting in the configuration section below.
        2. Add image types if needed (most users can ignore that part).
        3. Upload this file (sig.php) to your webserver.  I recommend
           uploading it to the same folder as your images.
        4. Link to the file as you would any normal image file, like this:

                        <img src="">



        5. You can also specify the image to display like this:

                        <img src="">

                This would specify that an image named "gorilla.jpg" located
                in the image-rotation folder should be displayed.

        6. Note, you may have to add a fake param to the url, to fake out
           the [img]blabla[/img] on bulletin boards.. i know i have to do
           this for ubbthreads and ipb.

           Example: [img]

           The parsing code will get fooled by seeing a .jpg at the end and
           voila, you get a rotating siggie.

        7. Note 2, this could also be done for avatars... i leave that to you.

        That's it, you're done.


/* ------------------------- Config -----------------------

        Set $folder to the full path to the location of your images.
        For example: $folder = '/user/me/';
        If the sig.php file will be in the same folder as your
        images then you should leave it set to $folder = '.';


        $folder = '.';


        Most users can safely ignore this part.  If you're a programmer,
        keep reading, if not, you're done.  Go get some coffee.

    If you'd like to enable additional image types other than
        gif, jpg, and png, add a duplicate line to the section below
        for the new image type.

        Add the new file-type, single-quoted, inside brackets.

        Add the mime-type to be sent to the browser, also single-quoted,
        after the equal sign.

        For example:

        PDF Files:

                $extList['pdf'] = 'application/pdf';

    CSS Files:

        $extList['css'] = 'text/css';

    You can even serve up random HTML files:

            $extList['html'] = 'text/html';
            $extList['htm'] = 'text/html';

    Just be sure your mime-type definition is correct!


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

// You don't need to edit anything after this point.

// --------------------- END CONFIGURATION -----------------------

$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;

        // If we have at least 1 image
        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);
} 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,  "Bleh, nothing there", $text_color);
                imagepng ($im);

Step 3. Go to File->Save, with these settings.

File Name: sig.php
Save type as: all files

If you plan to put your images in a different folder than this php, feel free to configure it. I suggest keeping it simple and leaving it default

Step 4. On your website host, upload your images and your sig.php file. If you did not configure your php file, and instead kept it as default, upload them all in the same folder

Step 5. On the forum, use the regular [IMG][/IMG] tags, except with the php file as the image location. On some forums, it will not work, but, for now it does. There is a way to make it work even on forums where it doesn't work, but I haven't encountered the problem, so I'm too lazy to find a solution.