Only fill this in if you're a spammer huh? Your name :
Your email :
Your message :

Technical shit

It's shit that's technical ...... technicality may vary with your ability to be baffled by bullshit

Forum signatures

I got bored

Somewhere on the evo forums someone muttered about the possibility of creating a plugin that generated a forum sig pic from a plugin ... can't find the thread now so no link I'm afraid. Anyway, I decided to have a play at generating one, and then went a tad overboard with it ... and then I showed toppie, and she demanded more features ... I should learn to never show her a bloody pony :P .... anyway, if you want one then this is what you do ... or, more precisely, this is what I did, if it works for you then great ;)

First off, create a folder to serve all the images from, I used "/forum-sig/" because I'm imaginative like that, so all of the code posted assumes that you do the same ... if you don't then edit anywhere you see /forum-sig/ and replace it with /your-folder/ huh?

Txt ( /forum-sig/.htaccess ) :

RewriteEngine On
 
#rewrite www to non-www ... change this if you have urls that expend user energy
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1 [R=301,L]
 
RewriteCond %{SCRIPT_FILENAME} !forum-sig/index.php
RewriteRule .*      ./index.php [L]

PHP ( /forum-sig/index.php ) :

<?php
require_once dirname(__FILE__).'/_settings.php';
 
// grab the domain name
$web $_SERVER'HTTP_HOST'];
// grab the url slug
$request preg_replace'~/forum-sig/([^\.]+?)\..+?$~''$1'$_SERVER'REQUEST_URI' ] );
// check we have settings
if( !empty$urls[$web][ $request ] ) )
// we do
    $settings $urls[$web][ $request ];
}
else
// we don't
    exit(); // invalid/unknown request
}
 
$search array'&amp;' );
$replace array'&' );
 
 
// lets see if we have an image already and what it's file stamp is
$file dirname(__FILE__).'/cached/'.$request.'.png';
 
if( !is_file$file ) || ( time() - filemtime$file ) ) > ( $settings['cache'] * 60 ) )
{
    $ch curl_init();
 
    curl_setopt($chCURLOPT_URL$settings['feed'].'?tempskin=_rss2' );
    curl_setopt($chCURLOPT_HEADER0);
    curl_setopt ($chCURLOPT_RETURNTRANSFER1) ;
    $res curl_exec($ch);
    curl_close($ch);
 
    preg_match'~<item>.+?<title>(.+?)</title>.+?<pubDate>(.+?)</pubDate>.+?<category[^>]+?>(.+?)</category>.+?</item>~s'$res$matches );
 
    $title str_replace$search$replace$matches[1] );
    $tagline str_replace$search$replacepreg_replace'~.+?,\s(.+?)\s[0-9]{4}\s.+?$~''$1'$matches[2] ).' - '.$matches[3] );
    if( !$settings['background']['image'] || !isfiledirname(__FILE__).'/'.$settings['background']['image'] ) )
    { // no background image, lets make our own
        $image imagecreatetruecolor$settings['background']['width'], $settings['background']['height'] );
        $colour hex2rgb$settings['background']['color'] );
        $background ImageColorAllocate$image$colour['red'], $colour['green'], $colour['blue'] ) ;
        $colour hex2rgb$settings['background']['border'] );
        $border ImageColorAllocate$image$colour['red'], $colour['green'], $colour['blue'] ) ;
        imagefill$image00$background );
        imagerectangle$image00$settings['background']['width'] - 1$settings['background']['height'] - 1$border );
    }
    $colour hex2rgb$settings['title']['color'] );
    $title_color ImageColorAllocate$image$colour['red'], $colour['green'], $colour['blue'] ) ;
    $colour hex2rgb$settings['tagline']['color'] );
    $tagline_color ImageColorAllocate$image$colour['red'], $colour['green'], $colour['blue'] ) ;
 
 
    imagettftext$image,$settings['title']['size'], 08intval$settings['background']['height'] / ) - 5$title_color'fonts/'.$settings['title']['font'], $title ) ;
    imagettftext$image,$settings['tagline']['size'], 024$settings['background']['height'] - 6$tagline_color'fonts/'.$settings['tagline']['font'], $tagline ) ;
 
    header('Content-type: image/png') ;
    imagepng$image$file );
    imagepng$image );
 
    imagedestroy$image ) ;
}
else
{    // serve cached image
    header('Content-type: image/png') ;
    echo implode''file$file ) );
}
exit() ;
 
function hex2rgb$hex_colour '' )
{
    $hex_colour preg_replace'~^#~'''$hex_colour );
    if( strlen$hex_colour ) == )
    {
        $cut 2;
    }
    else
    {
        $cut 1;
    }
    $rgb array();
    $rgb['red'] = hexdecsubstrsubstr$hex_colour0$cut ).substr$hex_colour0$cut ), 0) );
    $rgb['green'] = hexdecsubstrsubstr$hex_colour$cut$cut ).substr$hex_colour$cut$cut ), 0) );
    $rgb['blue'] = hexdecsubstrsubstr$hex_colour$cut 2$cut ).substr$hex_colour$cut 2$cut ), 0) );
    return $rgb;
}
?>

PHP ( /forum-sig/_settings.php ) :

<?php
$urls array(
    'innervisions.org.uk' => array// this is the domain that will be called for the sig
            'all' => array// url slug for this feed
                'cache' => 60// number of minutes to cache image for
                'feed' => 'http://innervisions.org.uk/'// feed url
                'title' => array// title settings
                        'font' => 'alako-bold.ttf'// font to use ( font must be in the fonts sub folder )
                        'size' => 14// font size to use
                        'color' => '#cc9'// hex colour to use
                ),
                'tagline' => array// tagline settings
                        'font' => 'zillah_modern_narrow.ttf',
                        'size' => 14,
                        'color' => '#eeb',
                ),
                'background' => array(
                        'image' => false// false or relative path to image to use
                        'width' => 240// width of generated image ( will be auto detected if you use a background image )
                        'height' => 50// height of generated image ( will be auto detected if you use a background image )
                        'color' => '#000'// background colour to use ( if no backgriound image )
                        'border' => '#888'// border colour to use ( if no background image )
                ),
            ),
            'babbles' => array// url slug for this feed
                'cache' => 60// number of minutes to cache image for
                'feed' => 'http://innervisions.org.uk/babbles/'// feed url
                'title' => array// title settings
                        'font' => 'alako-bold.ttf'// font to use ( font must be in the fonts sub folder )
                        'size' => 14// font size to use
                        'color' => '#cc9'// hex colour to use
                ),
                'tagline' => array// tagline settings
                        'font' => 'zillah_modern_narrow.ttf',
                        'size' => 14,
                        'color' => '#eeb',
                ),
                'background' => array(
                        'image' => false// false or relative path to image to use
                        'width' => 240// width of generated image ( will be auto detected if you use a background image )
                        'height' => 50// height of generated image ( will be auto detected if you use a background image )
                        'color' => '#000'// background colour to use ( if no backgriound image )
                        'border' => '#888'// border colour to use ( if no background image )
                ),
            ),
            'pastel' => array// url slug for this feed
                'cache' => 0// number of minutes to cache image for
                'feed' => 'http://randsco.com/'// feed url
                'title' => array// title settings
                        'font' => 'alako-bold.ttf'// font to use ( font must be in the fonts sub folder )
                        'size' => 14// font size to use
                        'color' => '#cc9'// hex colour to use
                ),
                'tagline' => array// tagline settings
                        'font' => 'zillah_modern_narrow.ttf',
                        'size' => 14,
                        'color' => '#eeb',
                ),
                'background' => array(
                        'image' => false// false or relative path to image to use
                        'width' => 240// width of generated image ( will be auto detected if you use a background image )
                        'height' => 50// height of generated image ( will be auto detected if you use a background image )
                        'color' => '#ccf'// background colour to use ( if no backgriound image )
                        'border' => '#888'// border colour to use ( if no background image )
                ),
            ),
            'bimble' => array// url slug for this feed
                'cache' => 60// number of minutes to cache image for
                'feed' => 'http://innervisions.org.uk/bimble/'// feed url
                'title' => array// title settings
                        'font' => 'alako-bold.ttf'// font to use ( font must be in the fonts sub folder )
                        'size' => 14// font size to use
                        'color' => '#cc9'// hex colour to use
                ),
                'tagline' => array// tagline settings
                        'font' => 'zillah_modern_narrow.ttf',
                        'size' => 14,
                        'color' => '#eeb',
                ),
                'background' => array(
                        'image' => false// false or relative path to image to use
                        'width' => 240// width of generated image ( will be auto detected if you use a background image )
                        'height' => 50// height of generated image ( will be auto detected if you use a background image )
                        'color' => '#000'// background colour to use ( if no backgriound image )
                        'border' => '#888'// border colour to use ( if no background image )
                ),
            ),
        ),
    'waffleson.co.uk' => array// this is the domain that will be called for the sig
            'code' => array// url slug for this feed
                'cache' => 60// number of minutes to cache image for
                'feed' => 'http://waffleson.co.uk/'// feed url
                'title' => array// title settings
                        'font' => 'alako-bold.ttf'// font to use ( font must be in the fonts sub folder )
                        'size' => 14// font size to use
                        'color' => '#cc9'// hex colour to use
                ),
                'tagline' => array// tagline settings
                        'font' => 'zillah_modern_narrow.ttf',
                        'size' => 14,
                        'color' => '#eeb',
                ),
                'background' => array(
                        'image' => false// false or relative path to image to use
                        'width' => 240// width of generated image ( will be auto detected if you use a background image )
                        'height' => 50// height of generated image ( will be auto detected if you use a background image )
                        'color' => '#000'// background colour to use ( if no backgriound image )
                        'border' => '#888'// border colour to use ( if no background image )
                ),
            ),
        ),
    );
?>

That's about it, create a subfolder called /forum-sig/cached ( needs to be writeable, that's probably 0777 to those of you on a server that requires "bitch slap me hacker" permisssions ) and you need to upload the fonts of your choice to /forum-sig/fonts/

Shit to note :

  • I haven't added background image support yet, lemme know if you want it
  • I'm never gonna make this a plugin because if you put your sig on a popular forum it'd kill a server
  • I have no intentions of animating it :|
  • The bbcode you need is [url=http://the_relevant_domain.com][img]http://the_relevant_domain.com/forum-sig/slug.png[/img][/url]
  • It requires curl, but it's not rocket science to add fscokopen huh?
  • If you own a pastel website then your sig will probably look this crap :
    some pastel palace

¥

I may have opened the door, but you entered of your own free will

 
 
Gary users avatar

Posts : 420

Joined : 04/04/05

Replied on : 01/06/09 @ 02:21 pm #1

Guess I will have to become a member of a forum so that I can use this plug-in :D I was a member of a bird forum once, until the children's trampoline took over the bird feeding spot in my garden :( Shame really I use to enjoy watching the birds whilst eating my breakfast.

Gz

Blog-a-doodle-do :D  http://garysblog.co.uk

 
 
¥åßßå users avatar

Posts : 1110

Joined : 10/05/05

Location : 127.0.0.1

Replied on : 01/06/09 @ 02:28 pm #2

I'm never gonna make this a plugin because if you put your sig on a popular forum it'd kill a server

There's always the evo forums ;)

¥

I may have opened the door, but you entered of your own free will

 
 
Gary users avatar

Posts : 420

Joined : 04/04/05

Replied on : 01/06/09 @ 05:33 pm #3

errrr, yer - there's that as well

Gz

Blog-a-doodle-do :D  http://garysblog.co.uk

 
 
tilqicom users avatar

Posts : 31

Joined : 06/02/08

Location : teh lonely country

Replied on : 02/14/09 @ 02:31 pm #4

shoot, i just have missed this one before.. nice stuff

test

 
 
¥åßßå users avatar

Posts : 1110

Joined : 10/05/05

Location : 127.0.0.1

Replied on : 02/14/09 @ 03:48 pm #5

Imagine all the other gems that are currently unknown by you ;)

¥

I may have opened the door, but you entered of your own free will

 
 

Who's Online?

  • Guests ( 2 )
 
 
 

X