php基於GD庫畫五星紅旗的方法_php技巧

來源:互聯網
上載者:User

本文執行個體講述了php基於GD庫畫五星紅旗的方法。分享給大家供大家參考。具體分析如下:

這裡執行個體分析php畫的五星紅旗(GD庫),代碼如下:

複製代碼 代碼如下:
<?php
header("Content-Type:image/jpeg");
$ing = imagecreatetruecolor(700,410);
//建立一個真彩色映像,傳回值為一個映像標識符,背景預設為黑色,參數(x_size*y_size)
$red = imagecolorallocate($ing,255,0,0);//定義背景顏色
$yellow = imagecolorallocate($ing,237,231,32);//定義黃色
imagefill($ing,0,0,$red);//填充顏色,以座標(0,0)開始起填充
//數組座標,表示(x1,y1,x2,y2,x3,y3.....x11,y11);
$a = array(90,30,108,73,157,73,119,102,135,152,93,123,52,152,66,102,29,74,76,73,90,30);
imagefilledpolygon($ing,$a,10,$yellow);//畫一個多邊形:10表示頂點總數,$yellow表示填充色
$a1 = array(229,25,229,43,248,48,229,55,229,74,217,60,198,66,210,50,197,34,218,39,229,25);
imagefilledpolygon($ing,$a1,10,$yellow);
$a2 = array(227,108,227,127,245,134,228,139,227,157,215,143,196,149,208,132,196,117,215,122,227,108);
imagefilledpolygon($ing,$a2,10,$yellow);
$a3 = array(163,184,163,204,181,211,163,216,163,234,152,220,132,225,144,209,132,193,151,199,163,184);
imagefilledpolygon($ing,$a3,10,$yellow);
$a4 = array(65,209,65,228,84,235,65,240,65,259,54,245,33,249,46,233,34,217,53,224,68,209);
imagefilledpolygon($ing,$a4,10,$yellow);
ob_clean();
imagejpeg($ing);
imagedestroy($ing);
?>

希望本文所述對大家的php程式設計有所協助。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.