Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!isset($_GET['text'])) {
- echo 'Error';
- exit;
- }
- $pic_name = $_GET['text'];
- $img = imagecreatefrompng ("../imgsource/trikotblank.png");
- $text_color = imagecolorallocate($img, 255, 255, 255); // Schriftfarbe
- $font_file = "../fonts/masque.TTF"; // Schriftart
- $font_size = 12; // Schriftgröße
- $text_x = 10; // Pos X
- $text_y = 117; // Pos Y
- imagettftext($img, $font_size, 0, ImageTTFCenter($img,$_POST['text'],$font_file,$font_size), $text_y, $text_color, $font_file, $_POST['text']);
- imagepng($img, '../images/user/'.$pic_name.'.png');
- //imagedestroy($img);
- //echo "https://$_SERVER[HTTP_HOST]trikotprinter/images/user/$pic_name.png";
- 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