PHP ?? ?? ?? ?? ???
?? ?? ?? ??? ?? ? ???? ??? ??? ?? ?????.
?? ?? ?? ??? ????? ???.
imagecreatetruecolor(); ???? ???? ?? ??? ???????.
??: ??
resource imagecreatetruecolor (int $width, int $height)
??: ??? $width?? ??? $height
? ??? ???? ?????. ?? ? ??? ???? ????, ?? FALSE? ?????. ??.
???? ?? ??? ???? ??? ???? ???
imagecolorallocate
??: ??
int imagecolorallocate (resource $image, int $red, int $green, int $blue);
Chapter One ???? , ? ??? ??? ???? ?? ????? RGB ??? ?????.
??? ?? ??
header("content-type:image/png");
imagepng ($image);
Destroy resources
imagedestroy($img);
??? ???????
???? ??? ??? ?????
<?php //第一步 創(chuàng)建一個畫布 $image = imagecreatetruecolor(100, 30); //創(chuàng)建一個寬為100高為30的黑色圖像 $bgcolor = imagecolorallocate($image, 255, 0, 0); //為圖像分配顏色 imagefill($image,0,0,$bgcolor); //給黑色的背景圖像分配白色 //輸出圖像 header("content-type:image/png"); imagepng($image); //銷毀資源 imagedestroy($img); ?>
?? ???? ??? ?? 100, ?? 30, ??? ??? ???? ???? ?? ? ? ????