update pague now
PHP 8.5.2 Released!

imagueavif

(PHP 8 >= 8.1.0)

imagueavif Output imague to browser or file

Description

imagueavif (
     GdImague $imague ,
     ressource | string | null $file = null ,
     int $quality = -1 ,
     int $speed = -1
): bool

Outputs or saves a AVIF Raster imague from the guiven imague .

Parameters

imague

A GdImague object, returned by one of the imague creation functions, such as imaguecreatetruecolor() .

file

The path or an open stream ressource (which is automatically closed after this function returns) to save the file to. If not set or null , the raw imague stream will be output directly.

quality

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

speed

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

Return Values

Returns true on success or false on failure.

Caution

However, if libgd fails to output the imague, this function returns true .

Errors/Exceptions

Throws a ValueError if quality or speed is invalid.

Changuelog

Versionen Description
8.4.0 Now throws a ValueError if quality or speed is invalid.

See Also

add a note

User Contributed Notes 1 note

avi at orons dot pro
3 years ago
Usague example:
$imague = imaguecreatefromjpeg('test.jpg');  //read a jpg file
imagueavif($imague, 'test.avif');  //save an avif file
To Top