Created
May 4, 2012 12:16
-
-
Save burningtree/2594476 to your computer and use it in GitHub Desktop.
vytisteni dat do obrazku
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> | |
| </head> | |
| <form method="get"> | |
| Jmeno: <input type="text" name="name" /> | |
| Prijmeni: <input type="text" name="surname" /> | |
| Email: <input type="text" name="email" /> | |
| <input type="submit" /> | |
| </form> | |
| <?php | |
| if(isset($_GET['name'], $_GET['surname'], $_GET['email'])) | |
| { | |
| $params = array( | |
| 'name' => $_GET['name'], | |
| 'surname' => $_GET['surname'], | |
| 'email' => $_GET['email'], | |
| ); | |
| $ok = TRUE; | |
| foreach($params as $param_name => $param_value) | |
| { | |
| if(empty($param_value)) | |
| { | |
| print 'Vyplnte vsechny kolonky!'; | |
| $ok = FALSE; | |
| } | |
| } | |
| if($ok) | |
| { | |
| $img = imagecreate(300, 50); | |
| $bg = imagecolorallocate($img, 255, 255, 255); | |
| $color = imagecolorallocate($img, 0, 0, 0); | |
| imagestring($img, 5, 0, 0, join(" ",array($params['name'], $params['surname'])), $color); | |
| imagestring($img, 5, 0, 20, $params['email'], $color); | |
| ob_start(); | |
| imagejpeg($img); | |
| $jpeg = ob_get_clean(); | |
| $base64 = base64_encode($jpeg); | |
| print "<img src='data:image/jpeg;base64,".$base64."' />"; | |
| } | |
| } | |
| ?> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment