(PHP 4, PHP 5)
imagerectangle — Draw a rectangle
imagerectangle() creates a rectangle starting at the specified coordinates.
imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.
Upper left x coordinate.
Upper left y coordinate 0, 0 is the top left corner of the image.
Bottom right x coordinate.
Bottom right y coordinate.
A color identifier created with imagecolorallocate().
성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.
Example #1 Simple imagerectangle() example
<?php
// Create a 200 x 200 image
$canvas = imagecreatetruecolor(200, 200);
// Allocate colors
$pink = imagecolorallocate($canvas, 255, 105, 180);
$white = imagecolorallocate($canvas, 255, 255, 255);
$green = imagecolorallocate($canvas, 132, 135, 28);
// Draw three rectangles each with its own color
imagerectangle($canvas, 50, 50, 150, 150, $pink);
imagerectangle($canvas, 45, 60, 120, 100, $white);
imagerectangle($canvas, 100, 120, 75, 160, $green);
// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>
위 예제의 출력 예시: