Computer >> 컴퓨터 >  >> 프로그램 작성 >> PHP

PHP의 imagefilledrectangle() 함수

<시간/>

imagefilledrectangle() 함수는 채워진 사각형을 그립니다.

구문

imagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )

매개변수

  • 이미지
    imagecreatetruecolor()를 사용하여 빈 이미지를 만듭니다.

  • x1
    점 1의 x 좌표입니다.

  • y1
    점 1의 y 좌표입니다.

  • x2
    점 2의 x 좌표입니다.

  • y2
    점 2의 y 좌표입니다.

  • 색상
    채우기 색상입니다.

돌아가기

imagefilledrectangle() 함수는 성공하면 TRUE를, 실패하면 FALSE를 반환합니다.

예시

다음은 예입니다.

<?php
   // Create an image
   $img = imagecreatetruecolor(500, 300);
   $color = imagecolorallocate($img, 0, 128, 128);
   imagefilledrectangle($img, 30, 30, 470, 270, $color);
   header("Content-type: image/png");
   imagepng($img);
   imagedestroy($img);
?>

출력

다음은 출력입니다.

PHP의 imagefilledrectangle() 함수