Add project files
This commit is contained in:
29
00_uebungs-files/03_docker-compose/src/image-test.php
Normal file
29
00_uebungs-files/03_docker-compose/src/image-test.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Test für GD Extension
|
||||
header('Content-Type: image/png');
|
||||
|
||||
// Canvas erstellen (300x200px)
|
||||
$image = imagecreatetruecolor(300, 200);
|
||||
|
||||
// Farben definieren
|
||||
$background = imagecolorallocate($image, 0, 153, 204);
|
||||
$text_color = imagecolorallocate($image, 255, 255, 255);
|
||||
$border_color = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
// Hintergrund füllen
|
||||
imagefill($image, 0, 0, $background);
|
||||
|
||||
// Rahmen zeichnen
|
||||
imagerectangle($image, 0, 0, 299, 199, $border_color);
|
||||
|
||||
// Text schreiben
|
||||
$text = "GD funktioniert!";
|
||||
imagestring($image, 5, 60, 80, $text, $text_color);
|
||||
|
||||
// Zeit anzeigen
|
||||
$time = date('H:i:s');
|
||||
imagestring($image, 3, 100, 120, "Zeit: $time", $text_color);
|
||||
|
||||
// Bild ausgeben
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
Reference in New Issue
Block a user