imageavif

(PHP 8 >= 8.1.0)

imageavif輸出圖象到瀏覽器或文件。

說明

imageavif(
    GdImage $image,
    resource|string|null $file = null,
    int $quality = -1,
    int $speed = -1
): bool

Outputs or saves a AVIF Raster image from the given image.

參數(shù)

image

由圖象創(chuàng)建函數(shù)(例如imagecreatetruecolor())返回的 GdImage 對象。

file

文件保存的路徑或者已打開的流資源(此方法返回后自動關(guān)閉該流資源),如果未設(shè)置或?yàn)?null,將會直接輸出原始圖象流。

quality

quality is optional, and ranges from 0 (worst quality, smaller file) to 100 (best quality, larger file). If -1 is provided, the default value 30 is used.

speed

speed is optional, and ranges from 0 (slow, smaller file) to 10 (fast, larger file). If -1 is provided, the default value 6 is used.

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false

警告

如果 libgd 輸出圖像失敗,函數(shù)會返回 true

參見

  • imagepng() - 以 PNG 格式將圖像輸出到瀏覽器或文件
  • imagewbmp() - 以 WBMP 格式將圖像輸出到瀏覽器或文件
  • imagejpeg() - 輸出圖象到瀏覽器或文件。
  • imagetypes() - 返回當(dāng)前 PHP 版本所支持的圖像類型