使用PHP GD库绘制图像,不显示的问题

1.使用PHP中的GD库绘制图像,,之后浏览器无法显示,GD库安装,配置也没什么错误,提示图像因本身有错无法显示,于是就在header() 前面使用ob_clean();然后使用浏览器就能正常的浏览了

<?php

$height = 300;$width = 300;$im = imagecreatetruecolor($width, $height);$white = imagecolorallocate ($im, 255, 255, 255);$blue = imagecolorallocate ($im, 0, 0, 64);imagefill($im, 0, 0, $blue);imagestring($im, 10, 100, 120, ‘Hello,PHP’, $white); ob_clean();header (‘Content-type: image/png’);imagepng($im);imagedestroy($im);

?>

flush() – 刷新输出缓冲  

2.判断GD库是否安装

使用函数fnction_exists()

if(function_exists(‘imagecreate’)){echo"已成功安装";}

版权声明:本文为博主原创文章,未经博主允许不得转载。

临行之前,面对太多的疑问和不解:为何是一个人?

使用PHP GD库绘制图像,不显示的问题

相关文章:

你感兴趣的文章:

标签云: