我试图制作一个标志性创作者,除了图像创建部分外,一切似乎都在工作,它会显示死图像。
这是代码
<?php
define('IP', '62.210.182.42');
include "koneksi.php";
if(isset($_GET['user']))
{
$query = $koneksi->prepare("select * from `playerdata` where `user` = ?");
$query->execute(array($_GET['user']));
$data = $query->fetch();
$font_dir = 'fonts/';
$text = 'Undefined';
$font = 'Transformers Movie.ttf';
$font2 = 'pricedown bl.ttf';
if($query->rowCount() > 0)
{
$type_space = imagettfbbox(25, 0, $font_dir.$font, $text);
$image_width = abs($type_space[4] - $type_space[0]) + 20;
$image_height = abs($type_space[5] - $type_space[1]) + 20;
$im = imagecreatefromjpeg("img/signature.jpg");
imagesavealpha($im, true);
imagealphablending($im, true);
$bg = imagecolorallocatealpha($im, 255, 255, 255, 127);
$putih = imagecolorallocate($im, 255, 255, 255);
$hitam = imagecolorallocate($im, 0, 0, 0);
$abu = imagecolorallocate($im, 0, 100, 255);
$biru = imagecolorallocate($im, 245, 184, 0);
imagefill($im, 0, 0, $bg);
function CreateTitle($name = "Undefined", $title = "GG Player")
{
$size_title = 20;
global $hitam, $putih, $font, $font_dir, $im, $biru, $font2;
$gambat = imagettftext($im, $size_title, 0, 26, 30, $hitam, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title, 0, 27, 31, $hitam, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title, 0, 28, 32, $hitam, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title, 0, 29, 34, $hitam, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title, 0, 25, 29, $biru, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title, 0, 25, 29, $biru, $font_dir.$font2, $name);
$gambat = imagettftext($im, $size_title-6, 0, 250, 27, $hitam, $font_dir.$font2, $title);
$gambat = imagettftext($im, $size_title-6, 0, 251, 28, $hitam, $font_dir.$font2, $title);
$gambat = imagettftext($im, $size_title-6, 0, 252, 29, $hitam, $font_dir.$font2, $title);
$gambat = imagettftext($im, $size_title-6, 0, 253, 30, $hitam, $font_dir.$font2, $title);
$gambat = imagettftext($im, $size_title-6, 0, 250, 27, $biru, $font_dir.$font2, $title);
$gambat = imagettftext($im, $size_title-6, 0, 250, 27, $biru, $font_dir.$font2, $title);
}
function CreateStats($nomer = 1, $baris = 1, $name, $size_title = 18)
{
$width = 60;
$height = 31;
global $biru, $hitam, $font, $font_dir, $im, $biru;
for($a = 1; $a < $nomer; $a++)
$width+=19;
for($a = 1; $a < $baris; $a++)
$height+=130;
$gambat = imagettftext($im, $size_title-5, 0, $height + 1, $width + 1, $hitam, $font_dir.$font, $name);
$gambat = imagettftext($im, $size_title-5, 0, $height + 2, $width + 2, $hitam, $font_dir.$font, $name);
$gambat = imagettftext($im, $size_title-5, 0, $height, $width, $biru, $font_dir.$font, $name);
}
function CreateIP($ip = IP)
{
$size_title = 15;
global $biru, $hitam, $font, $font_dir, $im, $biru;
$gambat = imagettftext($im, $size_title-5, 0, 320, 102, $hitam, $font_dir.$font, $ip);
$gambat = imagettftext($im, $size_title-5, 0, 321, 103, $hitam, $font_dir.$font, $ip);
$gambat = imagettftext($im, $size_title-5, 0, 322, 104, $hitam, $font_dir.$font, $ip);
$gambat = imagettftext($im, $size_title-5, 0, 323, 105, $hitam, $font_dir.$font, $ip);
$gambat = imagettftext($im, $size_title-5, 0, 320, 102, $biru, $font_dir.$font, $ip);
$gambat = imagettftext($im, $size_title-5, 0, 320, 102, $biru, $font_dir.$font, $ip);
}
if($data['level'] == 1)
$title = "Junior Administrator ";
else if($data['level'] == 2)
$title = "Junior Administrator ";
else if($data['level'] == 3)
$title = "Moderator";
else if($data['level'] == 4)
$title = "Senior Administrator ";
else if($data['level'] == 5)
$title = "Head Administrator ";
else if($data['level'] == 6)
$title = "Co-Owner ";
else if($data['level'] == 1337)
$title = "Owner ";
else
$title = "YGG Player ";
if($data['level'] == 1)
$title .= "Basic VIP ";
else if($data['level'] == 2)
$title .= "Silver VIP ";
else if($data['level'] == 3)
$title .= "Gold VIP ";
if($data['YG'] == 1)
$title .= "TG Member";
else if($data['YG'] == 0)
$title .= "Not TG";
CreateTitle($data['user'], $title);
CreateStats(1, 1, "Score : ".$data['score']);
CreateStats(2, 1, "Money : ".$data['money']);
CreateStats(3, 1, "Kills : ".$data['kills']);
CreateStats(1, 2, "Deaths : ".$data['deaths']);
$total = $data['kill'] / $data['deaths'];
CreateStats(2, 2, "K/D Ratio : ".round($total, 1));
CreateStats(3, 2, "Bank : ".$data['Bank']);
CreateIP();
header('Content-type: image/jpeg');
imagejpeg($im);
}
else
{
header("Location:signature.html");
}
}
?>
为什么不创建图像?
我不是这方面的专业人士,如果我犯了任何错误,仍然是新手如此宽恕。
由于