作者LPH66 (ha(ruhi|yate)ism)
看板PHP
标题Re: [请益] 关於gd画图
时间Fri Mar 16 12:54:12 2007
看你似乎是要做计数器
我贴个我自己写的计数器的显示部份给你参考
//在前面把要显示的数字放进$number中
$image=imagecreate(50,20); //建立
$white=imagecolorallocate($image,255,255,255); //白, 背景
$green=imagecolorallocate($image,0,128,0); //绿
$purple=imagecolorallocate($image,128,0,128); //紫
imagestring($image,4,1,1,sprintf("%06d",$number),$green);//绿数字
imagerectangle($image,0,0,49,19,$purple); //紫外框
imagepng($image); //显示
imagedestroy($image); //摧毁
这样出来会是类似
┌───┐
│001234│
└───┘
---
回到你的问题
http://tw2.php.net/manual/en/function.imagegif.php
第二个参数的说明是
filename
The path to the saved file. If not set or NULL, the raw image stream will be
outputed directly.
也就是说 有第二个参数且不是NULL 会输出到档案
没有第二个参数或第二个设成NULL 则会直接输出
如果你是要用<img src="xx.php">这方式显示的话 请用直接输出的 (如我上面那段)
imagejpeg/imagepng/imagewbmp等皆同
--
実琴:「
河野!你真的就这样被
物质慾望给吸引过去了吗?!」
亨:「只要
穿着女装摆出亲切的样子,所有必要花费就能
全免,似乎一点都不坏啊。」
実琴:「难道你没有
男人的尊严了吗?!」
亨:(断然道)「
没有。在
节衣缩食且
生活吃紧的
学生面前,
没有那种东西。」
--プリンセス・プリンセス 第二话
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 192.192.197.115