最后网上最简单的代码在图像上写文字[关闭]

I'm newbie in PHP , i have a project to write text on image , I search all the net for free and simple function to write text on image and after 10 days seaching and trying codes I got this

it works 100% with any PHP script you need JustAnotherHand.ttf font and canvas.png in directory to work with you plus imagick installed on your server

I did it but i canoot make it automatically done with wordpress so my quoestion is 1- change $text = "lorem lorem lorem lorem lorem lorem"; by wordpress post title my trial was

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

2-change file_put_contents('file33333333.png', $image); by post_id in order to easily echo each image of each post my trial was

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

3-echo final image link in each post my trial was

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" />';

Why not try the getter function:

$text = get_the_title();

Instead of the "dump" function?