PHP 中的 imagefill() 函式


imagefill() 函式用於填充影像。

語法

imagefill(img, x, y, color)

引數

  • img
    使用 imagecreatetruecolor() 建立一張空白影像。

  • x 
    起始點的 x 座標


  • 起始點的 y 座標

  • color 
    填充顏色。

返回值

imagefill() 函式在成功時返回 TRUE,在失敗時返回 FALSE。

示例

以下是一個示例

<?php
   $img = imagecreatetruecolor(400, 400);
   $color = imagecolorallocate($img, 190, 255, 120);
   imagefill($img, 0, 0, $color);
   header('Content-type: image/png');
   imagepng($img);
   imagedestroy($img);
?>

輸出

以下為輸出

更新於: 31-Dec-2019

306 次瀏覽

開啟你的 事業

透過完成課程考取認證

開始學習
廣告
© . All rights reserved.