欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

玩轉(zhuǎn)圖像函數(shù)庫(kù)—常見圖形操作

 更新時(shí)間:2006年09月03日 00:00:00   作者:  

我盡量不說大理論,諸如什么是png,自己查解決.

PHP自4.3版本開始,捆綁了自己的GD2庫(kù),用戶可以自己下載并設(shè)置.如果要查看自己的php版本是否支持gd模塊(支持JPEG,PNG,WBMP但不再支持GIF),如下方式是一種方法:

if(!function_exists('imagecreate')) {
die('本服務(wù)器不支持GD模塊');
}

如果不支持的話,如何配置 ? 下載gd模塊的dll文件,修改php.ini,重啟服務(wù)器即可.

以下簡(jiǎn)稱PHP作圖為PS.

當(dāng)您打算 PS的話,應(yīng)該完成如下如下步驟,這是必經(jīng)的.

1:創(chuàng)建基本PS對(duì)象(我假設(shè)為$image),填充背景(默認(rèn)黑),以后的全部ps操作都是基于這個(gè)背景圖像的.
2:在$image上作圖.
3:輸出這個(gè)圖像.
4:銷毀對(duì)象,清除使用內(nèi)存.

首先,我們來(lái)認(rèn)識(shí)幾個(gè)常用的函數(shù),這些函數(shù)在php手冊(cè)里面都有詳細(xì)介紹,此處大體引用下.

resource imagecreate ( int x_size, int y_size )
imagecreate() 返回一個(gè)圖像標(biāo)識(shí)符,代表了一幅大小為 x_size 和 y_size 的空白圖像。
此函數(shù)基本同imagetruecolor($width,$height).

int imagecolorallocate ( resource image, int red, int green, int blue )
imagecolorallocate() 返回一個(gè)標(biāo)識(shí)符,代表了由給定的 RGB 成分組成的顏色。image 參數(shù)是 imagecreatetruecolor() 函數(shù)的返回值。red,green 和 blue 分別是所需要的顏色的紅,綠,藍(lán)成分。這些參數(shù)是 0 到 255 的整數(shù)或者十六進(jìn)制的 0x00 到 0xFF。imagecolorallocate() 必須被調(diào)用以創(chuàng)建每一種用在 image 所代表的圖像中的顏色。

bool imagefill ( resource image, int x, int y, int color )
imagefill() 在 image 圖像的坐標(biāo) x,y(圖像左上角為 0, 0)處用 color 顏色執(zhí)行區(qū)域填充(即與 x, y 點(diǎn)顏色相同且相鄰的點(diǎn)都會(huì)被填充)。


bool imageline ( resource image, int x1, int y1, int x2, int y2, int color )
imageline() 用 color 顏色在圖像 image 中從坐標(biāo) x1,y1 到 x2,y2(圖像左上角為 0, 0)畫一條線段。

bool imagestring ( resource image, int font, int x, int y, string s, int col )
imagestring() 用 col 顏色將字符串 s 畫到 image 所代表的圖像的 x,y 坐標(biāo)處(這是字符串左上角坐標(biāo),整幅圖像的左上角為 0,0)。如果 font 是 1,2,3,4 或 5,則使用內(nèi)置字體。

array imagettftext ( resource image, float size, float angle, int x, int y, int color, string fontfile, string text )
本函數(shù)比較重要,參數(shù)較多,此處不再列出,它主要是寫字到圖像上,和上面的函數(shù)類似,但必前者強(qiáng)大.

bool imagefilltoborder ( resource image, int x, int y, int border, int color )
imagefilltoborder() 從 x,y(圖像左上角為 0, 0)點(diǎn)開始用 color 顏色執(zhí)行區(qū)域填充,直到碰到顏色為 border 的邊界為止?!咀ⅲ哼吔鐑?nèi)的所有顏色都會(huì)被填充。如果指定的邊界色和該點(diǎn)顏色相同,則沒有填充。如果圖像中沒有該邊界色,則整幅圖像都會(huì)被填充。】

bool imagefilledellipse ( resource image, int cx, int cy, int w, int h, int color )
imagefilledellipse() 在 image 所代表的圖像中以 cx,cy(圖像左上角為 0, 0)為中心畫一個(gè)橢圓。w 和 h 分別指定了橢圓的寬和高。橢圓用 color 顏色填充。如果成功則返回 TRUE,失敗則返回 FALSE。

輸出圖像數(shù)據(jù):imagepng($image[,$filename])

相關(guān)文章

最新評(píng)論