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

Php 最后用最简单的代码在网上把文字写在图片上,php,image,text,wordpress,Php,Image,Text,Wordpress,我是PHP的新手,我有一个在图像上写文本的项目,我在网上搜索免费的简单函数在图像上写文本,经过10天的搜索和尝试代码,我得到了这个 它100%适用于任何PHP脚本 您只需要目录中的另一个hand.ttf字体和canvas.png就可以使用 加上服务器上安装的imagick 我做了,但我不能用wordpress自动完成 所以我的问题是 1-更改 $text=“lorem-lorem-lorem-lorem-lorem” 按wordpress帖子标题 我的审判是 $text = "<?php

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

它100%适用于任何PHP脚本 您只需要目录中的另一个hand.ttf字体和canvas.png就可以使用 加上服务器上安装的imagick

我做了,但我不能用wordpress自动完成 所以我的问题是 1-更改
$text=“lorem-lorem-lorem-lorem-lorem”
按wordpress帖子标题
我的审判是

$text = "<?php the_title(); ?>";
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" />';
$text=”“;
2-更改文件内容('file33333333.png',$image); 通过post_id,以便轻松地回显每个帖子的每个图像 我的审判是

wp-content/uploads/2014/<?php the_ID(); ?>.png
wp content/uploads/2014/.png
每个帖子中的3-echo最终图像链接 我的审判是

$text = "<?php the_title(); ?>";
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" />';
echo.png“alt=”;时间('fds,Y');echo'align=“left”style=“margin:0 2px 0”/>;

为什么不试试getter函数:

$text = get_the_title();

与“dump”功能不同,它是“lorem”,而不是“loprem”。但是关于post id呢?wp content/uploads/2014/.png
获取id
。我甚至不用Wordpress,我只是在谷歌上搜索了“Wordpress获取id”。