xenForo signature generator?

Discussion in 'XenForo Discussions' started by Brandon, Oct 6, 2011.

  1. Brandon

    Brandon Regular Member

    Joined:
    Jun 1, 2009
    Messages:
    6,602
    Likes Received:
    1,706
    Location:
    Topeka, Kansas
    First Name:
    Brandon
    I have a similar script on my other xenforo setup, will add it here asap.

    http://xenaddicts.com/sig/generator.php

    it produces something like this by just adding my user ID

    .

    Have you set a page up on your forum, was it easy, can I see a demo?

    Thanks!
    -Brandon
     
    Last edited by a moderator: Jan 6, 2014
  2. stewart1champ

    stewart1champ Regular Member

    Joined:
    Aug 12, 2011
    Messages:
    16
    Likes Received:
    0
    I looked around for this as well... to see how it was done, or if I could figure it out myself... never got any luck though.
     
  3. Cerberus

    Cerberus Admin Talk Staff

    Joined:
    May 3, 2009
    Messages:
    1,031
    Likes Received:
    500
    Simple google I found the script and its php.. If you need help I can read php like reading a book :)

    Image needed

    awww.erikswan.net_sigbackground.png

    PHP:
    <?php
    // XenForo signature generator by Erik Swan :)

    function getPage($url){
        
    $ch curl_init();
        
    curl_setopt($ch,CURLOPT_URL$url);
        
    curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE);
        
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
        
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
        
    curl_setopt($chCURLOPT_USERAGENT'XenForo Signature Generator by Eriksrocks');
        
    curl_setopt($ch,CURLOPT_TIMEOUT,10);
        
    $html=curl_exec($ch);
        if(
    $html==false){
          
    $m=curl_error(($ch));
          
    error_log($m);
        }
        
    curl_close($ch);
        return 
    $html;
    }

    $username  'eriksrocks';
    $userid    '103';

    $page getPage('http://xenforo.com/community/members/' $username '.' $userid '/mini-stats.xml');
    $xml simplexml_load_string($page);
    $likes $xml->total_likes;
    $trophies $xml->trophy_points;

    // DEFINE STUFF
    $font 'square.ttf';
    $size 27;
    $x1 45;
    $x2 136;
    $y 43;
    $width 198;
    $height 76;
    $kerning 3;

    // DRAW

    $final imagecreatefrompng("sigbackground.png");
    $black imagecolorallocate($final000);

    imagealphablending($finaltrue); // setting alpha blending on
    imagesavealpha($finaltrue); // save alphablending setting (important)

    $array str_split($likes);
    $hpos $x1;

    for(
    $i=0$i<count($array); $i++)
    {
        
    $bbox imagettftext$final$size0$hpos$y$black$font$array[$i] );
        
    $hpos intval($bbox[2])+$kerning;
    }

    $array str_split($trophies);
    $hpos $x2;

    for(
    $i=0$i<count($array); $i++)
    {
        
    $bbox imagettftext$final$size0$hpos$y$black$font$array[$i] );
        
    $hpos intval($bbox[2])+$kerning;
    }

    // OUTPUT

    header('Content-type: image/png');
    imagepng($final);
    imagedestroy($final);
    ?> 
     
    Brandon likes this.
  4. SpacewardAsh

    SpacewardAsh Lurking From Space

    Joined:
    Jan 2, 2011
    Messages:
    211
    Likes Received:
    683
    Location:
    Falmouth, Cornwall, UK
    First Name:
    Ashley
    Brandon likes this.

Share This Page