Usage example:$image = imagecreatefromjpeg('test.jpg'); //read a jpg fileimageavif($image, 'test.avif'); //save an avif file(PHP 8 >= 8.1.0)
imageavif — Invia l'immagine al browser o in un file
$image,$file = null,$quality = -1,$speed = -1
Outputs or saves a AVIF Raster image from the given image.
imageUna risorsa immagine, restituita da una delle funzioni di creazione immagine, come imagecreatetruecolor().
file
Il percorso in cui salvare il file. Se non è impostato o è null, viene restituito il flusso raw dell'immagine.
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 52 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.
Restituisce true in caso di successo, false in caso di fallimento.
However, if libgd fails to output the image, this function returns true.
Throws a ValueError if quality
or speed is invalid.
| Versione | Descrizione |
|---|---|
| 8.4.0 |
Now throws a ValueError if quality
or speed is invalid.
|
Usage example:$image = imagecreatefromjpeg('test.jpg'); //read a jpg fileimageavif($image, 'test.avif'); //save an avif file