Dutch PHP Conference 2025 - Call For Papers

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.

Параметри

image

Об'єкт GdImage, що повертається однією з функцій створення зображення, такою як imagecreatetruecolor().

file

Шлях або відкритий ресурс потоку (котрий автоматично закривається після повернення з цієї функції) для збереження файла. Якщо не встановлено або дорівнює 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.

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Застереження

Проте, якщо libgd не може вивести зображення, ця функція повертає true.

Прогляньте також

  • imagepng() - Output a PNG image to either the browser or a file
  • imagewbmp() - Вивід зображення в браузер чи файл.
  • imagejpeg() - Вивід зображення в браузер чи файл.
  • imagetypes() - Return the image types supported by this PHP build
add a note

User Contributed Notes 1 note

up
0
avi at orons dot pro
1 year ago
Usage example:
$image = imagecreatefromjpeg('test.jpg'); //read a jpg file
imageavif($image, 'test.avif'); //save an avif file
To Top