所以我正在创建带有文本的图像生成器。
我希望文本始终位于图像的中间,如果可能的话,可以使用字体缩放。但是我不知道该怎么做。
截屏: https://i.stack.imgur.com/avYaQ.jpg
//the default "quote" settings
$myquotetext = '';
$fontsizemyquote = "70";
$ttfmyquote = "assets/myfonts/IMPACT.TTF";
//font positioning and color can be changed from the index page. Find $colorsauthor = imagecolorallocate($startimage, 0, 0, 0) and make any necessary adjustments.
//QTP myquote
$fontrotation = "0";
$str = wordwrap($myquotetext, 40, "\n", true);
$x = "130";
$y = "320";
$colormyquote = imagecolorallocate($startimage, 0, 0, 0);
imagettftext($startimage, $fontsizemyquote, $fontrotation, $x, $y, $colormyquote, $ttfmyquote, $str);