<?PHP
// Set your character name.
$character = $_GET['name'];
// Do not edit the variables below.
$link = "http://www.tibia.com/community/?subtopic=characters&name=";
$character = str_replace ( " " , "%20" , $character );
$content = file_get_contents ( $link . $character );
$check1 = explode ( "Level:" , $content );
$check2 = explode ( "World:" , $check1[1] );
$check3 = explode ( "<TD>" , $check2[0] );
$check4 = explode ( "</TD>" , $check3[1] );
// Some basic setup
$imageWidth = 50;
$imageHeight = 20;
$textFont = "tahoma.ttf";
$textSize = 18;
$textString = $check4[0];
// Set the headers content type
header("Content-type: image/png");
// Create the image
$image = imagecreatetruecolor($imageWidth, $imageHeight);
// Create some colors
$white = imagecolorallocate($image, 0, 0, 0);
$black = imagecolorallocate($image, 255, 255, 255);
// Fill the background of our image
imagefilledrectangle($image, 0, 0, $imageWidth, $imageHeight, $black);
// Get box info
$box = imagettfbbox($textSize, 0, $textFont, $textString);
//Find out the width and height of the text box
$textW = $box[2] - $box[0];
$textH = $box[5] - $box[3];
// Calculate the positions
$positionLeft = ($imageWidth - $textW)/2;
$positionTop = (($imageHeight - $textH)/2);
// Add some text
imagettftext($image, $textSize, 0, $positionLeft, $positionTop+2, $white, $textFont, $textString);
// Output the image to the browser
imagepng($image);
// Destroy the image
imagedestroy($image);
?>