PHP? ??? ?? ??? ???? ??? ????.
?? ??? ???.
? ??? ??? ??? ????
?? ??? ?? ??? ? ????.
1. ??? ????
2. ??? ??? ? ??? ??? ?????
3. ??? ???
4. ??? ? ? ???
5. ? ?? ? ???
6. ? ?? ???? ???
7. ?? ??
8. ??? ??
1. ? ??? ???? ??? ???????. ???? ?? ??? ??? ?????.
//使用imagecreate函數(shù)創(chuàng)建圖片,返回資源 $img = imagecreate(500,500);
2. ???? ??? ? ??? ???? ??? ???? ??,
$顏色變量 = imagecolorallocate ( resource $圖片資源 , int $紅 , int $綠 , int $藍(lán) )
?? ???? ???, ??, ???? ????? ??? ???? ?? ?? 3?????. ? ? ?? ??? ???? ??? ???? ? ? ?? ?? ??? ?????.
??? imagecolorallocate? ?? ??? ???? ???? ? ???? ?????. ? ??? ??? ??? ?????.
??? ?? ? ???? ?? ??? ?? ??? ???? ?? ????.
? ??? ??? ???? ? ???
1. ??
2. ???
3. ???
4. ???
???? ?? ?? ??? ?? ???? ??? ?? ?? ??? ??? ?? ?????.
//紅 $red = imagecolorallocate($img, 255, 0, 0); //綠 $green = imagecolorallocate($img, 0, 255, 0); //藍(lán) $blue = imagecolorallocate($img, 0, 0, 255); //棕 $yellow = imagecolorallocate($img, 121, 72, 0);
???? ? ? ?? ?? ? ????? ??? ?? ????.
3. ??? ??? ???? ????.
imagefilledrectangle ( resource $圖片資源 , int $點(diǎn)1x軸, int $點(diǎn)1y軸 , int $點(diǎn)2x軸 , int $點(diǎn)2y軸 , int $color )
? ??? ????? ???? ?? ??? ??? ?????.
1. ?? x ??? y ??? ?????
2. ? ?? ??? ?? ? ????
3. ? ?? ?? ?? ??? ?? ?? ?? ??? ?? ????
? ??? ? ????.
? 1? ? 2? ?????? ?? ? ????. ??? ? ?? ???? ???? ???? ?? ? ????.
??? ??? ??? ???
1? ??? ???? x??? 0 ????, 1? ??? y?? ???? 0 ?????.
? 2? x?? ???? 500 ????, ? 2? y?? ???? 500 ?????.
4. ??? ? ?? ????
???? ????. ???? ??????.
? ?? ???? ??? 0? 0, 500? 500
? ?? ???? ??? 500? 0, 0? 500
imageline($img, 0, 0, 500, 500, $red); imageline($img, 500, 0, 0, 500, $blue);
5. ? ?? ?? ????
bool imagefilledellipse ( resource $圖片資源 , int $圓心x , int $圓心y , int $圓的寬 , int $圓的高 , int $圓的顏色 ) imagefilledellipse($img, 250, 250, 200, 200, $yellow);
? ??? ???? ?? ?? ??? ???. ?? ?? ??? ??? ???. ??? ??? ???? ??? ???, ???? ??? ?????.
6. ? ?? ????? ?????
rree??? ???? ??? ??????? ???????. ??? ?????.
7. ?? ??
imagefilledrectangle($img, 200, 200, 300, 300, $blue);
8.bool imagejpeg ( resource $image [, string $filename])
?? ?? ??? ???????:
imagedestroy($img);