Created
June 5, 2012 09:44
-
-
Save SunboX/2874014 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $bildUrl = ''; | |
| if(isset($_POST['submit_button'])){ // Formular wurde verschickt | |
| // Texte | |
| $ort = isset($_POST['ort']) ? $_POST['Ort'] : ''; | |
| $landkreis = isset($_POST['landkreis']) ? $_POST['landkreis'] : ''; | |
| $text = $ort . "\n" . $landkreis; | |
| // Bild erzeugen | |
| $img = imagecreate(200, 70); | |
| $bgColor = imagecolorallocate($img, 255, 255, 255); | |
| $textColor = imagecolorallocate($bild, 0, 0, 0); | |
| imagefill($img, 0, 0, $bgColor); | |
| imagestring($img, 2, 0, 0, $text, $textColor); | |
| // Das Bild als JPG speichern | |
| $bildUrl = 'schild_' . md5(microtime() . rand(0, 9999)) . '.jpg'; | |
| imagejpeg($img, $bildUrl); | |
| } | |
| ?> | |
| <!doctype html> | |
| <head> | |
| <meta charset="utf-8"> | |
| </head> | |
| <body> | |
| <form method="post" action="<?php echo basename($_SERVER['PHP_SELF']); ?>> | |
| <label for="ort">Ort:</label> <input type="text" name="ort"/><br/> | |
| <label for="landkreis">Landkreis:</label> <input type="text" name="landkreis"/><br/> | |
| <input type="submit" name="submit_button" value="Bildchen Anzeigen"/> | |
| </form> | |
| <?php if($bildUrl !== ''): ?> | |
| <br/><br/> | |
| <img src="<?php echo $bildUrl; ?>" width="200" height="70"/> | |
| <?php endif; ?> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment