myaac/tools/signature/gesior.php
slawkens d50fb7a291 * moved characters.php html code to Twig template
* moved news.php to Twig news.html template
* fixed some duplicated code in signature generators
* always check if name parameter is set when generating signatures
2017-09-01 17:00:29 +02:00

32 lines
1.4 KiB
PHP

<?php
defined('MYAAC') or die('Direct access not allowed!');
$font = SIGNATURES_FONTS . 'font.ttf';
$fontsize = 12;
$image = imagecreatefrompng(SIGNATURES_BACKGROUNDS . 'signature.png');
$color= imagecolorallocate($image , 255, 255, 255);
imagettftext($image , 12, 0, 20, 32, $color, $font, 'Name:');
imagettftext($image , 12, 0, 70, 32, $color, $font, $player->getName());
$vocation = 'Unknown vocation';
if(isset($config['vocations'][$player->getVocation()]))
$vocation = $config['vocations'][$player->getVocation()];
imagettftext($image , $fontsize, 0, 20, 52, $color, $font, 'Level:');
imagettftext($image , $fontsize, 0, 70, 52, $color, $font, $player->getLevel() . ' ' . $vocation);
$rank = $player->getRank();
if($rank->isLoaded())
{
imagettftext($image , $fontsize, 0, 20, 75, $color, $font, 'Guild:');
imagettftext($image , $fontsize, 0, 70, 75, $color, $font, $player->getRank()->getName() . ' of the ' . $$rank->getGuild()->getName());
}
imagettftext($image , $fontsize, 0, 20, 95, $color, $font, 'Last Login:');
imagettftext($image , $fontsize, 0, 100, 95, $color, $font, (($player->getLastLogin() > 0) ? date("j F Y, g:i a", $player->getLastLogin()) : 'Never logged in.'));
imagepng($image, SIGNATURES_CACHE . $player->getID() . '.png');
imagedestroy($image);
header('Content-type: image/png');
readfile(SIGNATURES_CACHE . $player->getId() . '.png');
?>