Need help with dynamic player signatures. [PHP and MySQL]
#4

Nothing changed still same problem this is my modified code.
pawn Код:
if ($i != 0) // If the user has been correct, then it'll give us 1 row. If its 1 row, then it'll proceed with the code.
{

    $Playername=mysql_result($result,0,"`Username`"); // Gets the username of the player and put it in the variable $Playername.
    $Money=mysql_result($result,0,"`pMoney`"); // Gets the money of the player and put it in the variable $Money.
    $Score=mysql_result($result,0,"`pKills`"); // Gets the score of the player and put it in the variable $Score.

    $text_username = "$Playername"; // This gets the information: player name to be showed in the picture.
    $text_score = "$Score"; // Same as above but with score.
    $text_money = "$Money"; // Same as above but with money.

    $font_size = 18; // Font size is in pixels.
    $font_file = 'Action.ttf'; // This is the path to your font file.

    // Create image:
    $image = imagecreatetruecolor(450, 110); // Create a truecolor image 450x110

    // Allocate text and background colors (RGB format):
    $bg_color = imagecolorallocate($image, 0, 0, 0);
    $text_color = imagecolorallocate($image,237,176,07);

    // Fill image:
    imagefill($image, 0, 0, $bg_color);

    $bg_image = imagecreatefrompng("playersign.png"); // Load PNG image
    imagecopy($image,$bg_image,0,0,0,0,450,110); // Then copy it into our image

    imagettftext($image, 16, 0, 0, 0, $text_color, $font_file, $text_username); // Prints the username in the picture.  
    imagettftext($image, 16, 0, 1, 1, $text_color, $font_file, $text_score); // Prints the score in the picture.
    imagettftext($image, 16, 0, 2, 2, $text_color, $font_file, $text_money); // Prints the money in the picture.

    header('Content-Type: image/png'); // Don't touch this. We use this to tell the script we're working with an image.

    imagepng($image);
    imagedestroy($image);
EDIT: Is the problem can be in image?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)