Hallo,
Ich hab mir ein Script besorgt welches Statistiken des jeweiligen Minecraftservers als Text anzeigt.
Jetzt möchte ich diese Statistik auf ein Image rauf hauen. Wie funktioniert das?
Durch Google hab ich ein Script gefunden weiß aber nicht wie ich das einbinden soll. Das Script war von einem Tutorial
wie man ein Smiley mit seiner eigenen IP erstellen kann. Ich habe versucht die beiden Scripts zu kombinieren habs aber nicht geschafft.
Ich bitte um Hilfe ;(
Ich hab mir ein Script besorgt welches Statistiken des jeweiligen Minecraftservers als Text anzeigt.
Jetzt möchte ich diese Statistik auf ein Image rauf hauen. Wie funktioniert das?
Code:
<?php
include_once 'MinecraftServerStatus/status.class.php';
$status = new MinecraftServerStatus();
$response = $status->getStatus('184.164.133.34');
if(!$response) {
echo"Der Server ist Offline.";
} else {
echo"Name: '".$response['motd']."'.
<br>
IP: ".$response['hostname']."
<br>
Version: ".$response['version']."
<br>
Spieler: ".$response['players']."/".$response['maxplayers'].".
<br>
Ping: ".$response['ping']." ms.";
}
?>
Durch Google hab ich ein Script gefunden weiß aber nicht wie ich das einbinden soll. Das Script war von einem Tutorial
wie man ein Smiley mit seiner eigenen IP erstellen kann. Ich habe versucht die beiden Scripts zu kombinieren habs aber nicht geschafft.
Ich bitte um Hilfe ;(
Code:
[COLOR=black][FONT=Consolas]<?php[/FONT][/COLOR][COLOR=#606060][FONT=Consolas]//IP Adresse des Browsers abfragen[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]$ip = $_SERVER['REMOTE_ADDR'];[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//Bild laden[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//(Name des Bildes, muss im gleichen Verzeichnis sein wie das PHP-Script)[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]$image = imagecreatefromgif ('ip-smilie.gif');[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//Farbe für den Text setzen[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//Farben werden als RGB-Wert übergeben:[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//z.B. 0 , 0 , 0 = Schwarz[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//z.B. 255, 255, 255 = Weiß[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//z.B. 0 , 0, 255 = Blau[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]$farbe = imagecolorallocate ( $image, 0, 0, 0 );[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//IP-Adresse in Bild schreiben[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//5 = Schriftgröße[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//50 = Text-Abstand im Bild von rechts (x-Achse)[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//12 = Text-Abstand im Bild von oben (y-Achse)[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]imagestring ( $image, 7, 45, 15, $ip, $farbe );[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]//Bild ausgeben[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]header("Content-Type: image/gif");[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]imagegif($image);[/FONT][/COLOR]
[COLOR=#606060][FONT=Consolas]ImageDestroy($image);[/FONT][/COLOR]
[COLOR=black][FONT=Consolas]?>[/FONT][/COLOR]