<?php
/**
 * Project:        M.VuiZ.Net
 * Author:         nampt.me <admin@vuiz.net>
 * Copyright:      © 2025 vuiz.net All rights reserved.
 */
header('Content-Type: image/png');
header('Content-disposition: attachment;filename="logo.png"');
//Get var
$kiten = empty($_GET['ki']) ? 'VuiZ.Net' : $_GET['ki'];
$size = empty($_GET['size']) ? 30 : $_GET['size'];
$goc = '0';

if(!isset($size) || $size<2)$size=20;

// Path to our font file
$ki = __DIR__.'/logo.ttf';
//Create our bounding box for the first text
$bbox = imagettfbbox($size,$goc,$ki,$kiten);

// Do dai cua text

$x = abs($bbox[0]) + abs($bbox[2]);
$y = abs($bbox[1]) + abs($bbox[5]);
//Dat but
$x+=30;
$y+=40;
//Dat but
$im  = imagecreatetruecolor($x,$y);
imagealphablending($im,false);
imagesavealpha($im,true);
$transparent = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefilledrectangle($im, 0, 0, $x,$y, $transparent);

$grey = imagecolorallocate($im,72,118,255);
$black =  imagecolorallocate($im, 0, 0, 0);

if($_GET['color'] == 1 || !isset($_GET['color']))
$color = $black;
else
if($_GET['color'] == 2)
$color = $grey;

//vjet
$tim = imagecreatefrompng('tim.png');
$t = imagecreatefrompng('t.png');
imagecopy($im,$tim,$x-59,0,0,0,51,74);
imagecopy($im,$t,$x/2,0,0,0,19,19);
imagettftext($im,$size,$goc,0,$y-25,$color,$ki, $kiten);


imagepng ($im);
imagedestroy ( $im );
?>