将php字符串转换为图像

use*_*085 -2 php string gd image

我想将 php 字符串转换为图像。我用这个代码

header("Content-type: image/png");
$string = '.the_title().';

$font  = 5;
$width  = imagefontwidth($font) * strlen($string);
$height = imagefontheight($font);

$image = imagecreatetruecolor ($width,$height);
$white = imagecolorallocate ($image,255,255,255);
$black = imagecolorallocate ($image,0,0,0);
imagefill($image,0,0,$white);

imagestring ($image,$font,0,0,$string,$black);

imagepng ($image);
imagedestroy($image)    
Run Code Online (Sandbox Code Playgroud)

但它显示 the_title 作为文本而不是执行字符串

Nin*_*nju 5

使用imagecreatefromstring

$string = '.the_title().';

$data = base64_decode($string);

$im = imagecreatefromstring($data);
if ($im !== false) {
    header('Content-Type: image/png');
    imagepng($im);
    imagedestroy($im);
}
Run Code Online (Sandbox Code Playgroud)