最后用网络上最简单的代码把文字写在图片上


Finally the simplest code on the net to write text on image

我是PHP新手,我有一个在图像上写文本的项目,我在所有网络上搜索免费和简单的在图像上编写文本的功能,经过10天的搜索和尝试代码,我得到了这个

它100%适用于任何PHP脚本您需要目录中的JustAnotherHand.ttf字体和canvas.png才能使用加上安装在服务器上的imagick

我做到了,但我无法用wordpress自动完成所以我的估计是1-更改$text = "lorem lorem lorem lorem lorem lorem";按wordpress帖子标题我的审判是

$text = "<?php the_title(); ?>";

2-更改文件输出内容('file33333333.png',$image);通过post_id,以便容易地回声每个帖子的每个图像我的审判是

wp-content/uploads/2014/<?php the_ID(); ?>.png

每个帖子中的3个回波最终图像链接我的审判是

echo '<img src="wp-content/uploads/2014/<?php the_ID(); ?>.png" alt="';the_time('F dS, Y');echo '" align="left" style="margin:0 2px 0 0" />';

为什么不尝试getter函数:

$text = get_the_title();

而不是"转储"功能?