Re: [請益] 關於gd畫圖
看你似乎是要做計數器
我貼個我自己寫的計數器的顯示部份給你參考
//在前面把要顯示的數字放進$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
討論串 (同標題文章)
完整討論串 (本文為第 6 之 6 篇):
請益
1
2