Advertisement
Guest User

Trikotprinter

a guest
Mar 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.  
  3.     if(!isset($_GET["bildtext"])) {
  4.         echo 'Error';
  5.         exit;
  6.     }
  7.     $pic_name = $_GET["bildtext"];
  8.     $img = imagecreatefrompng ("imgsource/trikotblank.png");
  9.     $text_color = imagecolorallocate($img, 18, 2, 2);                   //  Schriftfarbe
  10.     $font_file = "fonts/masque.TTF";                             // Schriftart
  11.     $font_size = 125;                                                        // Schriftgröße
  12.     $text_x = 117;                                                          //  Pos X
  13.     $text_y = 117;                                                          //  Pos Y
  14.     imagettftext($img, $font_size, 0, ImageTTFCenter($img,$_POST["bildtext"],$font_file,$font_size), $text_y, $text_color, $font_file, $_POST["bildtext"]);
  15.     imagepng($img, 'images/user/'.$pic_name.'.png');
  16.     //imagedestroy($img);
  17.     echo "<a href='http://$_SERVER[HTTP_HOST]/trikotprinter/images/user/$pic_name.png'>Profilbild von $pic_name</a>";
  18.     function ImageTTFCenter($image, $text, $font, $size, $angle = 0)
  19.     {
  20.         $xi = imagesx($image);
  21.         $box = imagettfbbox($size, $angle, $font, $text);
  22.         $xr = abs(max($box[2], $box[4]));
  23.         $x = intval(($xi - $xr) / 2);
  24.         return $x;
  25.     }  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement