<?php
/* ############################################################# */
// Simply put your user name and desired font here and you are set!
$user = "givenameplz";
$txtFont = 'calibri.ttf'; // File has to be in the same folder as this file!
/* ############################################################# */
// If you want to change the output messages, please do it here.
$output_is = "is";
$outputHappy = "(*^v^)/";
$outputSad = "(Q^Q)~";
$output_nowplaying = "Now Playing:";
/* ############################################################# */
// If you have no idea whats going on, don't touch anything below~
// Adding spaces~
$output_is = " ".$output_is." ";
$outputHappy = " ".$outputHappy;
$outputSad = " ".$outputSad;
$output_nowplaying = " ".$output_nowplaying." ";
header('content-type: image/png');
$image = imagecreatetruecolor(620, 10);
imagealphablending($image, false);
$bgCol = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $bgCol);
imagesavealpha($image, true);
$txtCol = imagecolorallocate($image, 128, 64, 128);
$txtNPCol = imagecolorallocate($image, 218, 54, 108);
$txtMapCol = imagecolorallocate($image, 188, 54, 98);
$txtSize = 8;
$txtAngle = 0;
$txtX = 1;
$txtY = 8;
$offset = calcMyFontPlz($user.$output_is,$txtFont,$txtSize,$txtAngle); // Offset for USERNAME is...
$np = file_get_contents('np.txt', NULL, NULL, 0, filesize('np.txt'));
$status = file_get_contents('status.txt', NULL, NULL, 0, filesize('status.txt'));
if(strpos($status,"Online") !== false && strpos($np,"Nothing Q^Q") !== false){
//Output if we're online but not playing anything
$txtStatus = "[Online]";
$txtStatusCol = imagecolorallocate($image, 0, 180, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputHappy);
} elseif(strpos($status,"Offline") !== false){
//Output if we're offline
$txtStatus = "[Offline]";
$txtStatusCol = imagecolorallocate($image, 180, 0, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputSad);
} else {
//Output if we're online playing a map!
$txtStatus = "[Online]";
$txtStatusCol = imagecolorallocate($image, 0, 172, 0);
$offset2 = calcMyFontPlz($txtStatus,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtCol, $txtFont, $outputHappy);
if(strlen($np) > 2){
$offset2 += calcMyFontPlz($outputHappy,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtNPCol, $txtFont, $output_nowplaying);
$offset2 += calcMyFontPlz($output_nowplaying,$txtFont,$txtSize,$txtAngle);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset + $offset2, $txtY, $txtMapCol, $txtFont, $np);
}
}
//Output Online/Offline message.
imagettftext($image, $txtSize, $txtAngle, $txtX, $txtY, $txtCol, $txtFont, $user.$output_is);
imagettftext($image, $txtSize, $txtAngle, $txtX + $offset, $txtY, $txtStatusCol, $txtFont, $txtStatus);
imagepng($image);
imagedestroy($image);
function calcMyFontPlz($string, $font, $size, $angle)
{
$result = imagettfbbox($size,$angle,$font,$string);
return $result[2];
}
?>