GDライブラリを使うには
■GDライブラリとは
PHP で使用できるグラフィックスライブラリです。
GD を利用することで、線や円を用いてビジュアル的なグラフを作成したり、様々なフォントの文字を画像で表示することができるようになります
設定方法
php.iniを開いて
;extension=php_gd2.dllの;を外し「extension=php_gd2.dll」にするだけ
【sample1.php】サンプルプログラム
//===============================
//5-7 GDライブラリを使う 線引き
//==============================
//headにPNG画面タイプを指定
header("Content-type: image/png");
//領域作成
$image = imagecreate(200, 200);
//背景色の描画(白)
$bcolor = imagecolorallocate($image, 255, 255, 255);
//色の作成(青)
$blue = imagecolorallocate($image, 0, 0, 255);
//色の作成(緑)
$green = imagecolorallocate($image, 0, 255, 0);
//四角を描く
imagefilledrectangle($image, 50,50,100,100,$blue);
//丸を描く
imagefilledellipse($image, 150,150,50,50,$green);
//png描画作成
imagepng($image);
//色リソースの開放
imagecolorallocate($image, $bcolor);
imagecolorallocate($image, $blue);
imagecolorallocate($image, $green);
//画像リソースの開放
imagedestroy($image);
?>
・結果

※コメント投稿者のブログIDはブログ作成者のみに通知されます