可以在GD和PHP中使用多行文本吗? [英] can I have multiline text with GD and PHP?

查看:94
本文介绍了可以在GD和PHP中使用多行文本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GD + PHP输出多行文本,但是无法正常工作.我的php知识真的很基础. 这是代码,关于如何输出2或3行文本的想法?

I'm trying to output multiline text with GD+PHP but can't get it working. my php knowledge is really basic. here's the code, any idea on how to output 2 or 3 lines of text?

$theText = (isset($_GET['caption']))? stripslashes($_GET['caption']) :'';
imagettftext($baseImage, $textSize, $textAngle, $textXposition, $textYposition, $textColor, $fontName, $theText);

推荐答案

imagettftext($baseImage, $textSize, $textAngle, $textXposition, $textYposition, $textColor, $fontName, $theText);
imagettftext($baseImage, $textSize, $textAngle, $textXposition+(25), $textYposition, $textColor, $fontName, $theText);
imagettftext($baseImage, $textSize, $textAngle, $textXposition+(50), $textYposition, $textColor, $fontName, $theText);

您必须添加x像素才能将其向下移动到X位置.请记住,您的整个图片应该足够高且足够宽以适合文本.

you have to add x pixel to move it downwards to the X position. keep in mind that your whole image should be high and wide enough to fit the text.

这篇关于可以在GD和PHP中使用多行文本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆