So you want folks on the forums to know your steam status but all the steam badge sites are gimped and produce boring, generic stuff like this:

Well now you can have something like this! (or something perhaps not quite as lame that you made.)

You’ll need:
- A rudimentary knowledge of PHP or just ‘code’ in general.
- A webhost with PHP 4/5 with GD Image Library & SimpleXML support.
- The path to your host’s fonts folder or a ttf font.
- Your sig image. For the purposes of this tutorial it’ll be 500×110 pixels, named ’sig’ and in stored in ‘png’ format.
- Your Steam Community profile RSS feed. (The path to your Steam Community page custom URL with “?xml=1″ appended. Like http://steamcommunity.com/id/yourname?xml=1 but with whatever you called it in place of ‘yourname’.)
- I think that’s it. Maybe some music playing while you photoshop?
To start, it should be noted that I know exactly fuckall about PHP in general so blame “Steven” over here if the code sucks. Also, if you see any glaring flaws or could help clean it up a bit I would love to hear it. Leave a note in the comments.
Alright, now open up your image creation software and create your 500×110 image. Since we’ll be placing our ’steam status’ line over the bottom 10ish pixels of our sig image of course we’ll want to make sure it contrasts with our white font color. The rest of the image can be whatever you like but I would suggest women with as little clothing as possible. Save this image as ’sig.png’ and set it aside.
Now launch your favorite text editor and paste this PHP code in a new plain-text document. Note that I’ve split it up a bit attempting to explain what’s going on but everything in the ‘code boxes’ all goes in the same file.
<?php
/* Original author: Steven Copyright 2009
found: http://forums.tizag.com/showthread.php?t=13830
adapted slightly by AttroPheed */
// tells your browser to render this PHP file as a jpeg.
header('Content-Type: image/jpeg');
// Only makes a sig if it's older than 2 minutes.
// Your host will love you for having the forethought.
if( (file_exists('cache.jpg')) && (time() - filemtime('cache.jpg') <= 120) )
{
readfile('cache.jpg');
exit;
}
Be sure and change out ‘attropheed’ in the URL below for whatever you set up your custom URL as.
// Remote XML URL and name of local copy for caching purposes
// change 'attropheed' to your steam profile url
$stm = 'http://steamcommunity.com/id/attropheed?xml=1';
$stmlocal = 'steam.xml';
// Makes sure you're only hitting your XML feed every 2 minutes
if( (!file_exists($stmlocal)) || (time() - filemtime($stmlocal) > 120) )
{
$contents = file_get_contents($stm);
$fp = fopen($stmlocal, "w");
fwrite($fp, $contents);
fclose($fp);
}
$xml = simplexml_load_file($stmlocal);
//Steam Status
//goes through the local XML file and grabs the 'stateMessage' item.
$gameinfo = $xml->stateMessage;
// Strip line break tag cuz it's ugly and swap 'In-Game' for 'Playing'
$gameinfo = str_replace("<br />", " ", "$gameinfo");
$gameinfo = str_replace("In-Game", "Playing", "$gameinfo");
Depending on your font choice you will need to adjust some of the stuff here. The code is pretty heavily commented and where it isn’t, it should be self explanatory. Also, If you have no idea where your host hides their fonts (I didn’t) you should be able to just upload any ttf font to the directory where you have your sig. I just dragged arial out of my Windows\fonts directory and uploaded it, but you can also go grab a less generic ttf font from dafonts.com or somewhere and use that too. Keep in mind that if your host is Linux (all the good ones are) it is a case sensitive OS. So if your font is called FoNt.TtF your settings below will need to reflect that.
// Background Image
$dest = imagecreatefrompng('./sig.png');
// Text Formatting Options
// the 255, 255, 255 is white but you can change it to whatever (R, G, B) color you like.
$color = imagecolorallocate($dest, 255, 255, 255);
$font = './arial.ttf';
$fontsize = "7";
//a fontangle of 90 would be rendered from bottom to top instead of left to right. While 180 would be upside down.
$fontangle = "0";
//where the text will appear in relation to the top left corner of our image
$xcord = "20";
$ycord = "108";
// You probably don't want to mess with stuff down here unless you know what you're doing.
// key: imagettftext (image, font size, font angle, X, Y, font color, font, text string)
ImageTTFText ($dest, $fontsize, $fontangle, $xcord, $ycord, $color, $font, $gameinfo);
The ‘95′ in the imagejpeg function below is the jpeg compression quality. If you have limited hosting you may want to decrease the quality a bit because a high traffic forum could sap your quota in short order.
// key: imagejpeg(Source Image, 'image name', compression quality);
imagejpeg($dest, 'cache.jpg', 95);
readfile('cache.jpg');
imagedestroy($dest);
?>
Save this file as ’sig.php’ and upload it and the ’sig.png’ you just created to your qualifying webhost. It may, in the interest of neatness, be a good idea to put all this stuff in its own folder because sig.php creates a few cache files when it’s run and we don’t want your root folder getting all cluttered.
Now enter http://yourhost.com/path/to/sig.php in your address bar and call your friends in the room to show them how fucking boss your new sig is.
If it doesn’t work you may need to chmod the directory to 755 or bug your host about compiling PHP with GD support or maybe you just misspelled your steam page URL or font name or path or whatever. PHP should make a file called ERROR_LOG in the directory if it screws up to help you decipher what went wrong. You can open this file with any text editor. Also, when you’re adjusting coordinates or changing font size and whatnot you’ll need to either adjust the timeout for ‘cache.jpg’ to like 10 seconds in sig.php or delete cache.jpg in your sig directory each time to see your changes, else you’ll have to wait 120 seconds (2 minutes).
Some forums wont allow a .php file in an [img] tag so you may need to create an .htaccess file in your sig directory to get them to see the light. Paste this in a new file and save it as “.htaccess” (with quotes or Windows might bitch.)
RewriteEngine On RewriteRule ^sig.jpg$ sig.php
This will allow you to link to sig.jpg and be directed to sig.php without the forum knowing the difference.
Possible that this information will be useful. There is a resource for learning to create a web form – php form tutorials.
Thanks! What this code is lacking though is something that tells you when your profile status can’t be retrieved (which happens a lot on steam).
Thanks