私は動的なユーザー統計の署名に取り組んでいます。
ここに私のコードがあります: UPDATED
<?php
//Send a generated image to the browser
$config->Host = 'localhost';
$config->User = 'grpg';
$config->Pass = 'E8vspAcP';
$config->DB = 'grpg_wp';;
$con = mysql_connect($config->Host,$config->User,$config->Pass);
if (!$con) die('<div class="errorbox">Nepavyko prisijungti prie duomenu bazes: '. mysql_error() .'</div>');
mysql_select_db($config->DB, $con);
$query = mysql_query("SELECT * FROM serverplayers WHERE id=1");
$showuser = mysql_fetch_assoc($query);
$user1 = $showuser['User'];
$user="$user1"; // or the value from your database
create_image($user);
function create_image($user)
{
//Set the image width and height
$width = 100;
$height = 20;
//Create the image resource
$image = ImageCreate($width, $height);
//We are making three colors, white, black and gray
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$grey = ImageColorAllocate($image, 204, 204, 204);
//Make the background black
ImageFill($image, 0, 0, $black);
//Add randomly generated string in white to the image
ImageString($image, 3, 30, 3, "$user", $white);
//Tell the browser what kind of file is come in
header("Content-Type: image/jpeg");
//Output the newly created image in jpeg format
ImageJpeg($image);
//Free up resources
ImageDestroy($image);
}
?>
これを変更$pass = "$user";
する$pass = "erlis";
と、ユーザー名が問題なく表示されます。ここでの取引は何ですか?画像はうまく表示されていますが、テキストがありません。わかりません...