Ne Frage ich will in PHP ein png Bild auf einem php Bild erstellen es ist eine Signatur.
Worauf ich einen roten Punkt erstellen will wenn der Spieler offline ist und wenn er online ist einen grünen?
PHP
<?php
$username="";
$password="";
$database="";
$host="";
$player_name=$_GET['player_name'];
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Fehler beim Verbinden zur Datenbank!.");
$player_name = stripslashes($player_name);
$player_name = mysql_real_escape_string($player_name);
$query="SELECT * FROM userdata WHERE Name='$player_name'";
$result=mysql_query($query);
$i=mysql_num_rows($result);
if ($i == 1)
{
$state=mysql_result($result,0,"state");
$Playername=mysql_result($result,0,"Name");
$Money=mysql_result($result,0,"Money");
$Score=mysql_result($result,0,"Bank");
header('Content-Type: image/png;');
$im = @imagecreatefrompng('mypicture.png') or die("Cannot select the correct image. Please contact the webmaster.");
$text_color = imagecolorallocate($im, 197,197,199);
$text_username = "$Playername";
$text_score = "$Score";
$text_money = "$Money";
$font = 'tahoma.ttf';
/* USAGE OF THE imagettftext: First ($im) shouldn't be changed. (16) is the text-size. (0) is the angle of your text. Change it, and you'll see what's going on. (20) is de X-coordinate of the text.
(36) is the Y-coordinate of the text. */
imagettftext($im, 16, 0, 25, 20, $text_color, $font, $text_username);
// imagettftext($im, 16, 0, 72, 69, $text_color, $font, $text_score);
// imagettftext($im, 16, 0, 72, 99, $text_color, $font, $text_money);
wenn state offline soll offline.png auch auf dem bild sein sonst online.png
imagepng($im);
imagedestroy($im);
} else echo('Es wurde kein Spieler mit diesem Namen in der Datenbank gefunden');
mysql_close();
?>
Alles anzeigen