imageellipse()
ImageEllipse()関数は、6つのパラメーターを受け入れます。
関数が正常に実行されるとtrueを返し、失敗した場合はfalseを返します。
<?php
// 空白の画像を作成します
$image = imagecreatetruecolor(700, 350);
// 背景色を選択します
$bg = imagecolorallocate($image, 0, 0, 0);
// 背景の色を埋めます
imagefill($image, 0, 0, $bg);
// 楕円の色を選択します
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
// 楕円を描きます
imageellipse($image, 325, 175, 500, 175, $col_ellipse);
// 出力画像
header("Content-type: image/png");
imagepng($image);
?>
<?php
// 空白の画像を作成します
$image = imagecreatetruecolor(700, 600);
// 背景色を設定します
$bg = imagecolorallocate($image, 122, 122, 122);
// 背景の色を埋めます
imagefill($image, 0, 0, $bg);
// 楕円の色を設定します
$col_ellipse = imagecolorallocate($image, 0, 255, 255);
// 楕円を描きます
imageellipse($image, 250, 300, 300, 550, $col_ellipse);
// 出力画像
header("Content-type: image/gif");
imagepng($image);
?>
上記の2つの例を使用して、PHPでImageLipse()関数を使用して楕円を描画する方法を示します。この関数は、グラフィックス処理アプリケーションとWeb開発の両方で、さまざまな画像描画タスクに適しています。