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 作为文本而不是执行字符串
使用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)
| 归档时间: |
|
| 查看次数: |
12536 次 |
| 最近记录: |