<?php


$version = trim(htmlspecialchars($_GET['s1']));
$color = trim(htmlspecialchars($_GET['s2']));
$string3 = trim(htmlspecialchars($_GET['s3']));
$string4 = trim(htmlspecialchars($_GET['s4']));



if ($version == 'black') {
	$im = imagecreatefrompng("../template/logo-black.png");

} elseif ($version == 'grey') {
	$im = imagecreatefrompng("../template/logo-grey.png");

} else {


	$im = imageCreateTrueColor (752, 200); 
	imagesavealpha($im, true);
	$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
	imagefill($im, 0, 0, $trans_colour);
}


if ($color == 'red') {
	$color = imagecolorallocate($im, 204, 0, 0);

} elseif ($color == 'green') {
	$color = imagecolorallocate($im, 0, 204, 0);

} elseif ($color == 'darkblue') {
	$color = imagecolorallocate($im, 0, 0, 204);

} elseif ($color == 'orange') {
	$color = imagecolorallocate($im, 255, 102, 0);

} elseif ($color == 'yellow') {
	$color = imagecolorallocate($im, 255, 204, 0);

} elseif ($color == 'purple') {
	$color = imagecolorallocate($im, 204, 0, 255);

} elseif ($color == 'pink') {
	$color = imagecolorallocate($im, 255, 0, 255);

} elseif ($color == 'brown') {
	$color = imagecolorallocate($im, 165, 42, 42);

} elseif ($color == 'lightblue') {
	$color = imagecolorallocate($im, 0, 102, 255);

} elseif ($color == 'gold') {
	$color = imagecolorallocate($im, 218, 168, 32);

} elseif ($color == 'silver') {
	$color = imagecolorallocate($im, 102, 102, 102);

} elseif ($color == 'steelblue') {
	$color = imagecolorallocate($im, 106, 90, 205);

} elseif ($color == 'white' && !$version) {
	$color = imagecolorallocate($im, 0, 0, 0);

} else { // white (or input: black, white)
	$color = imagecolorallocate($im, 255, 255, 255);
}

$font = '../../admin/font/CGFLocustResistance.ttf';
$size1 = 28;
$size2 = 12;

imagettftext($im, $size1, 0, 30, 80, $color, $font, $string3);
imagettftext($im, $size2, 0, 80, 180, $color, $font, $string4);


header("Content-type: image/png");
imagepng($im);
imagedestroy($im);

?>
