Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default MSN signature (XML + GD)

    Hello, I was bored and experimenting with GD as I'm not too good with it, so I made this:

    PHP Code:
    <?php
    $sxe 
    = new SimpleXMLElement('http://web2live.org/files/5653/stats.xml'NULLTRUE);

    header('Content-type: image/png');

    $im imagecreatetruecolor(40030);

    $white imagecolorallocate($im255255255);
    $black imagecolorallocate($im000);
    imagefilledrectangle($im0039929$white);

    imagettftext$im701020$black'Volter__28Goldfish_29.ttf''WLM: ' .$sxe->.' is ' $sxe->' ([email protected])' );

    imagepng($im);
    imagedestroy($im);
    ?>
    You'll need to get somewhere to generate the XML file, I used: web2live.org

  2. #2
    Join Date
    Mar 2008
    Location
    England, Cheshire.
    Posts
    173
    Tokens
    0

    Default

    they/we need the font aswell...

  3. #3
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by IntaMedia View Post
    they/we need the font aswell...
    www.dafont.com and search Volter.

  4. #4
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    I need this but does someone wanna guide me in-depth for rep+ ?

  5. #5
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Big Brother View Post
    I need this but does someone wanna guide me in-depth for rep+ ?
    Well..

    PHP Code:
    <?php 
    $sxe 
    = new SimpleXMLElement('http://web2live.org/files/5653/stats.xml'NULLTRUE); 

    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// HAS TO BE IN THE PATH OF THIS FILE, OR DEFINE THE PATH!
    $message 'WLM: ' .$sxe->.' is ' $sxe->' ('.$email.')';

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im); 
    ?>
    Quick revision to the code, more user friendly.

    Goto that web2live site, install the msgplus plugin that retrieves your MSN information, "Get signature codes" -> "Advanced" -> Copy link of the XML file, update the one I allocated -> Woo, you're off.

    You can define other things instead of MSN name, like song:

    PHP Code:
    <?php 
    $sxe 
    = new SimpleXMLElement('http://web2live.org/files/5653/stats.xml'NULLTRUE); 

    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// HAS TO BE IN THE PATH OF THIS FILE, OR DEFINE THE PATH!
    $message 'WLM: ' .$sxe->.' is ' $sxe->' and is listening too: ' $sxe->np;

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im); 
    ?>
    (but you'll have to fiddle with the spacing etc..)

  6. #6
    Join Date
    Aug 2006
    Posts
    6,572
    Tokens
    584

    Latest Awards:

    Default

    Quote Originally Posted by Calon View Post
    Well..

    PHP Code:
    <?php 
    $sxe 
    = new SimpleXMLElement('http://web2live.org/files/5653/stats.xml'NULLTRUE); 

    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// HAS TO BE IN THE PATH OF THIS FILE, OR DEFINE THE PATH!
    $message 'WLM: ' .$sxe->.' is ' $sxe->' ('.$email.')';

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im); 
    ?>
    Quick revision to the code, more user friendly.

    Goto that web2live site, install the msgplus plugin that retrieves your MSN information, "Get signature codes" -> "Advanced" -> Copy link of the XML file, update the one I allocated -> Woo, you're off.

    You can define other things instead of MSN name, like song:

    PHP Code:
    <?php 
    $sxe 
    = new SimpleXMLElement('http://web2live.org/files/5653/stats.xml'NULLTRUE); 

    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// HAS TO BE IN THE PATH OF THIS FILE, OR DEFINE THE PATH!
    $message 'WLM: ' .$sxe->.' is ' $sxe->' and is listening too: ' $sxe->np;

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im); 
    ?>
    (but you'll have to fiddle with the spacing etc..)
    Thanks alot, you should pass your trial!

  7. #7
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Big Brother View Post
    Thanks alot, you should pass your trial!
    Haha, thanks (I suck at detecting sarcasm).

  8. #8
    Join Date
    May 2008
    Posts
    1,160
    Tokens
    11

    Latest Awards:

    Default

    Nice release Calon. Hopefully you pass the trial!
    Previously a Habbo fanatic, web designer/developer, fansite owner, & trusted member of the community.

  9. #9
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    PHP Code:
    <?php

    //basic configuration here
    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// has to be relative to the php file, or define full path

    //grab the XML
    $xml = @file_get_contents"http://web2live.org/files/5653/stats.xml" );

    if( 
    $xml ){

        
    $sxe = new SimpleXMLElement$xml ); 
        
        
    $message "WLM Status: {$sxe->n} is currently {$sxe->s} ( {$email} ).";
        


    } else {
        
        
    $message "Sorry, there was an error in creating the status image.";        

    }

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im);

    ?>
    Wouldn't that be better? Note I did it quickly so sorry for errors.


    www.fragme.co = a project.

  10. #10
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    PHP Code:
    <?php

    //basic configuration here
    $email '[email protected]';
    $font 'Volter__28Goldfish_29.ttf'// has to be relative to the php file, or define full path

    //grab the XML
    $xml = @file_get_contents"http://web2live.org/files/5653/stats.xml" );

    if( 
    $xml ){

        
    $sxe = new SimpleXMLElement$xml ); 
        
        
    $message "WLM Status: {$sxe->n} is currently {$sxe->s} ( {$email} ).";
        


    } else {
        
        
    $message "Sorry, there was an error in creating the status image.";        

    }

    header('Content-type: image/png'); 

    $im imagecreatetruecolor(40030); 

    $white imagecolorallocate($im255255255); 
    $black imagecolorallocate($im000); 
    imagefilledrectangle($im0039929$white); 

    imagettftext$im701020$black$font$message ); 

    imagepng($im); 
    imagedestroy($im);

    ?>
    Wouldn't that be better? Note I did it quickly so sorry for errors.
    I didn't bother with if statements, as it's not wanting a user's input, it's the owner of the file uploader who will process the file, so I thought there would be no point.

    I prefer my code, as you've just added more, which isn't really needed.

    As they say, "speed is more than beauty".

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •