0

いくつかの問題に遭遇しましたが、PHP イメージを作成しようとしています。URLをphpファイルに追加しようとしています。URL (global.php) には、特定のユーザーのユーザー名を取得し、特定の画像ファイルを php 画像に入力するための情報が含まれています。

しかし、global.php リンクを追加するたびに、画像が表示されません。私の主な質問は、ファイルへのリンクを追加できるかどうか、さらに echo ' ' などを追加できるかどうかです。php画像ファイルに?

    <?php
// MySQL Connect & Select
mysql_connect('localhost', 'root', 'password') or die('Error connecting to mysql');
mysql_select_db('database');

$result = mysql_query("SELECT * FROM users WHERE username = '".stripslashes(trim(htmlspecialchars(mysql_real_escape_string(mysql_escape_string($_GET['user'])))))."'");
$row = mysql_fetch_array($result);
$result_stats = mysql_query("SELECT * FROM user_stats WHERE id = '".$row['id']."'") or die("USER_STATS: ".mysql_error());
$row_stats = mysql_fetch_array($result_stats);
$result_info = mysql_query("SELECT * FROM user_info WHERE user_id = '".$row['id']."'") or die("USER_INFO: ".mysql_error());
$row_info = mysql_fetch_array($result_info);

$text[1] = "Hiya, ".$row['username']."!";
$text[2] = "Your last login was ".@date("d-M-Y\n H:i",$row['last_online']).". We missed you :)";
$text[3] = "Do you know the Rare! Way";
$text[4] = "".$row['username']."?";
$text[5] = "I do!";
$text[6] = "Be sure to follow the Rare! Way. \n \n When you follow the Way, you're giving \n yourself the best experience on Rare! that you \n can ever get! Stay tuned for more.";

// Colors
$image      = imagecreatefrompng('userbanner/hotel.png');
$black      = imagecolorallocate($image, 0, 0, 0);
$white      = imagecolorallocate($image, 250, 250, 250);
$grey       = imagecolorallocate($image, 77, 77, 77);

// Font
$volterB    = 'userbanner/Ubuntu-B.ttf';
$volder     = 'userbanner/Ubuntu-M.ttf';
$conden     = 'userbanner/Ubuntu-L.ttf';
$light      = 'userbanner/Ubuntu-Regular.ttf';


$userimage1 = imagecreatefrompng("http://www.habbo.com/habbo-imaging/avatarimage?figure=".$row['look']."&direction=2&head_direction=2&gesture=spk&img_format=png");
imagecopy($image, $userimage1, 420, 288, 0, 0, 64, 110);




$userimage  = imagecreatefrompng("http://www.habbo.com/habbo-imaging/avatarimage?figure=".$row['look']."&direction=2&head_direction=2&gesture=sml&img_format=png");
imagecopy($image, $userimage, 220, 628, 0, 0, 64, 110);

// Create image from text
imagettftext($image, 15, 0, 20, 465, $black, $volterB, $text[1]);
imagettftext($image, 8, 0, 20, 483, $black, $conden, $text[2]);
imagettftext($image, 18, 0, 510, 300, $black, $volterB, $text[3]);
imagettftext($image, 15, 0, 510, 330, $black, $volterB, $text[4]);
imagettftext($image, 15, 0, 345, 333, $black, $volder, $text[5]);
imagettftext($image, 10, 0, 520, 360, $grey, $light, $text[6]);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);



?>

不明な点がありましたら、お知らせください。ありがとう :)

4

0 に答える 0