Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从表中的数据创建图像(PHP)_Php_Image.createimage - Fatal编程技术网

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

从表中的数据创建图像(PHP),php,image.createimage,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)

我想从我放在表中的数据创建一个图像

到目前为止,我的代码是:

$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);
$out=“将有数据”;
标题('Content-type:image/png');
$png_image=imagecreate(50500);
$tcol=imagecolorallocate($png_图像,255,255,0);
imagestring($png_image,4,30,25,$out,$tcol);
//回音$out;
imagepng($png_image);
图像销毁($png_图像);
但我得到的结果是:

�巴布亚新几内亚IHDR2�E7��PLTE�����体育���+伊达斯���1.�嗯����*�伊恩德�B`�


我做错了什么?

您的代码工作正常。我将此作为输出:


您必须使用
标记内的数据,或者您必须使用整个
$out
变量?我想使用整个
$out
变量来显示图像,您需要在HTML代码中使用一些
标记。。。