User:H Fern/sandbox/sig

<?php

//-START--// //-CONFIG-// ////

$yourIGN  = "H_Fern"; // Your Combat Arms in-game name

$sigImage  = "sig.jpg"; // The name of your sig graphic, including the extension

$fontFile  = "ARDARLING.ttf"; // The name of the font file you're using, must be in same folder

$textColor  = "black"; // Only one color. Choices: black, white, grey, red, green, blue, yellow, fuschia, orange, cyan, purple, pink

$showStats  = "ENLIST DATE,RANKING,K/D RATIO,Multi-Kills"; // Case-sensitive and seperated by a comma. I recommend a max of 6. Choices: ENLIST DATE,RANKING,K/D RATIO,EXP EARNED,CURRENT GP,CLAN,POSITION,Kills (K),Deaths (D),Headshots (H),Nutshots (N),Total Matches Played (TM),Matches Won (W),Matches Lost (L),Matches Forfeited (F),Multi-Kills,Ultra-Kills,Fantastic,Unbelievable

$showRank  = true;

$rankX  = 15;

$rankY  = 15;

$yPos     = 60; // The position of the text on the Y-axis (top to bottom). Play around with it to get a good position.

$xPos     = 310; // The position of the text on the X-axis (left to right). Play around with it to get a good position.

$verticalSpacing= 15; // The distance between each stat line

//--END---// //-CONFIG-// //--DO NOT TOUCH!-//

// LOAD PLAYER STATS FROM NEXON PAGE // // Also strips out html tags. //   $content_original = file_get_contents('http://combatarms.nexon.net/ClansRankings/PlayerProfile.aspx?user=' . $yourIGN); $content = preg_replace('/<.*?>/msi', '', $content_original); $content = preg_replace('/ /msi', '', $content);

// STRIPS OUT SPECIFIC STATS // // Set stripPercent to true if there is a percentage in the stat // function getStat($statName, $stripPercent = false){ global $content; $stat = trim(substr($content, strpos($content, $statName) + strlen($statName))); $stat = substr($stat, 0, strpos($stat, "\n"));

if($stripPercent){ $stat = preg_replace('/\[.*?\]/msi', '', $stat); }

return $stat; }

// LOAD THE BACKGROUND // // The main image to put the stats over. $imageExt = explode(".", $sigImage); if(strtolower($imageExt[1]) == "jpg"){ $image  = imagecreatefromjpeg($sigImage); }elseif(strtolower($imageExt[1]) == "png"){ $image  = imagecreatefrompng($sigImage); }else{ die("Unsupported filetype!"); }

// SET THE FONT FILE // // Location of the font file used. I believe it only works if it's in the same directory. Any TrueType font will work.

$font  = $fontFile;

// SET COLOURS // // Remove ones you don't need, and add others you do need. Values are in format (R, G, B) 0-255. //

$black  = imagecolorallocate($image, 0, 0, 0); $white   = imagecolorallocate($image, 255, 255, 255); $grey  = imagecolorallocate($image, 200, 200, 200); $red  = imagecolorallocate($image, 255, 0, 0); $green  = imagecolorallocate($image, 0, 255, 0); $blue  = imagecolorallocate($image, 0, 0, 255); $yellow  = imagecolorallocate($image, 255, 255, 0); $fuschia= imagecolorallocate($image, 255, 0, 255); $orange = imagecolorallocate($image, 255, 150, 0); $cyan  = imagecolorallocate($image, 0, 255, 255); $purple = imagecolorallocate($image, 150, 0, 0); $pink  = imagecolorallocate($image, 255, 0, 150);

$textColor = $$textColor;

// WRITE STATS // // imagettftext(IMAGE, FONT-SIZE, FONT-ANGLE, X-POS, Y-POS, FONT-COLOR, FONT-FILE, TEXT); //

$showStats = explode(",", $showStats);

for($x=0; $x<count($showStats); $x++){ imagettftext($image, 12, 0, $xPos, $yPos, $textColor, $font, ucwords(strtolower($showStats[$x])) . ": " . getStat($showStats[$x])); $yPos += $verticalSpacing; }

// WRITE RANK // // Only if told to, of course. ;) //

if($showRank){ $rank = trim(substr($content_original, strpos($content_original, 'PLAYER NAME'), 200)); $rank = explode('