Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!isset($_GET["bildtext"])) {
- echo 'Error';
- exit;
- }
- $pic_name = $_GET["bildtext"];
- $img = imagecreatefrompng ("imgsource/trikotblank.png");
- $text_color = imagecolorallocate($img, 18, 2, 2); // Schriftfarbe
- $font_file = "fonts/masque.TTF"; // Schriftart
- $font_size = 125; // Schriftgröße
- $text_x = 117; // Pos X
- $text_y = 117; // Pos Y
- imagettftext($img, $font_size, 0, ImageTTFCenter($img,$_POST["bildtext"],$font_file,$font_size), $text_y, $text_color, $font_file, $_POST["bildtext"]);
- imagepng($img, 'images/user/'.$pic_name.'.png');
- //imagedestroy($img);
- echo "<a href='http://$_SERVER[HTTP_HOST]/trikotprinter/images/user/$pic_name.png'>Profilbild von $pic_name</a>";
- function ImageTTFCenter($image, $text, $font, $size, $angle = 0)
- {
- $xi = imagesx($image);
- $box = imagettfbbox($size, $angle, $font, $text);
- $xr = abs(max($box[2], $box[4]));
- $x = intval(($xi - $xr) / 2);
- return $x;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement