根据表中的数据创建图像(PHP)

时间:2018-08-12 19:10:26

标签: php image.createimage

我想从放置在表格中的数据创建图像。

到目前为止,我的代码:

$out = "<table><tr><td>There will be data</td></tr></table>";
header('Content-type: image/png');
$png_image = imagecreate(50, 500);
$tcol = imagecolorallocate($png_image, 255, 255, 0);
imagestring($png_image, 4, 30, 25, $out, $tcol);
//echo $out;
imagepng($png_image);
imagedestroy($png_image);

但是我得到了这个输出:

  

PNGIHDR2�E7�PLTE���EpHYs���+IDATH�1�Om����*�IEND�B`

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您的代码运行正常。我得到这个作为输出:

OUTPUT