Home  >  Article  >  Backend Development  >  php制作图像的有关问题

php制作图像的有关问题

WBOY
WBOYOriginal
2016-06-13 10:15:27846browse

php制作图像的问题
//长和高
$_width = 75;
$_height = 25;

//创建一张图像
$_img = imagecreatetruecolor($_width,$_height);

//白色
$_white = imagecolorallocate($_img,255,255,255);

//填充
imagefill($_img,0,0,$_white);




//输出图像
header('Content-Type: image/png');
imagepng($_img);

//销毁
imagedestroy($_img);
在火狐浏览器中
以上代码一些,整个页面的背景变成灰色了,制作的图像在中间。但我看的教程是正常的,其他浏览器也是正常的。

------解决方案--------------------
那就是浏览器的问题了
------解决方案--------------------
你用php把图像保存为文件,再用火狐打开看看。就知道是不是浏览器的问题。
------解决方案--------------------
我记得好像火狐就是这样显示图片的吧,放在中间的,反正你的图片生成了是对的,就好了呀。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn