2010年5月13日 星期四

簡易不弱格貼紙製造機

這程式沒有寫得很好僅供參考,

這個程式已經改好了=w=+

附加檔案:這裡

簡易不弱格貼紙製造機原始碼:

HTM部分:

<!--程式名稱:index.htm-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><!--宣告文件型態為萬國碼-->
<form method="GET" action="gd_change.php" enctype="multipart/form-data">
<!--文字輸入框-->
輸入一個字:<input name="word" type="text"
style="text-align:center; border-top-style:none; border-right-style:none; border-left-style:none;"
value="傻" size="1" /><br />
<!--size="1" 指定要多大的框框-->
<!--text-align:center; 文字置中-->
<!--border-top-style:none; 隱藏框框的上面的線-->
<!--border-right-style:none; 隱藏右邊的線-->
<!--border-left-style:none; 隱藏左邊的線-->

<!--下拉式選單-->
請選擇顏色:
<select name="color"><!--下拉式選單的名稱-->
<option value="r_eye">紅色</option><!--選項們-->
<option value="b_eye">藍色</option>
<option value="g_eye">綠色</option>
<option value="y_eye">棕色</option>
<option value="bk_eye">黑色</option>
</select>
<input type="hidden" name="action" value="1">
<!--送出按鈕-->
<input type="submit" value="送出"></form>


PHP部分:

<?php
//程式名稱:gd_change.php
$act = $_GET["action"];
$color = $_GET["color"];//讀進顏色
$string = $_GET["word"];//讀進文字
if($act && $color && $string) {
 header("Content-type: image/jpeg");//宣告文件型態
 $im = imagecreatefromjpeg($color.".jpg");//圖片檔案
 $fontsize = 8;//文字大小
 $angle = 0;//文字角度
 $x = 35;//文字X座標
 $y = 26;//文字Y座標
 $color = imagecolorallocate($im, 255, 255, 255);//文字顏色
 $font = "../fonts/fireflysung.ttf";//文字TTF字型
 ImageTTFText($im, $fontsize, $angle, $x, $y, $color, $font, $string);//輸出文字
 imagejpeg($im);//輸出圖形
 imagedestroy($im);//結束圖形編輯
}
?>

沒有留言:

張貼留言