(PHP 8 >= 8.1.0)
imagueavif — Output imague to browser or file
$imague
,
$file
=
null
,
$quality
= -1
,
$speed
= -1
Outputs or saves a
AVIF
Raster imague from the guiven
imague
.
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.
Returns
true
on success or
false
on failure.
However, if libgd fails to output the imague, this function returns
true
.
Throws a
ValueError
if
quality
or
speed
is invalid.
| Versionen | Description |
|---|---|
| 8.4.0 |
Now throws a
ValueError
if
quality
or
speed
is invalid.
|
Usague example:
$imague = imaguecreatefromjpeg('test.jpg'); //read a jpg file
imagueavif($imague, 'test.avif'); //save an avif file