[請益] 關於gd畫圖

看板PHP作者 (哆啦A孟)時間17年前 (2007/03/15 20:48), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/6 (看更多)
以下程式 imagegif($im,"test.gif"); case1:沒有後面的test.gif結果可以顯示在頁面 case2:有test.gif時,頁面不可顯示,但有檔案test.gif產生,但利用令一個網頁 輸入<img src="xx.php">的時後,還是無法顯示。 搞不懂那裡有問題 @@' 請各位大大幫忙 感謝各位了 <?php $data="Menu.txt"; if(file_exists($data)) { $fp=fopen($data,"r"); $old_count=fread($fp,filesize($data)); $new_count=$old_count+1; fclose($fp); } else { $new_count=1; } $fp=fopen($data,"w"); fwrite($fp,$new_count); fclose($fp); header("Content-type:image/gif"); //設定header以讓瀏覽器將檔案視為圖檔 $im=ImageCreate(100,20); //產生一個空白圖 $red=ImageColorAllocate($im,255,0,0); //第一個ImagecolorAllocate決定背景顏色 $white=ImageColorAllocate($im,255,0,255); $yellow=ImageColorAllocate($im,255,255,0); Imagepng($im,5,3,3,$new_count,$yellow); //為一字串影像,im像是一個容器,ImageString像是內容物 Imagegif($im,"test.gif"); //輸出圖檔 ImageDestroy($im); //消毀圖片 ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.79.88
文章代碼(AID): #15-K2KGq (PHP)
文章代碼(AID): #15-K2KGq (PHP)