Support images avif si la fonction est disponible

This commit is contained in:
Fred Tempez 2023-08-01 20:37:23 +02:00
parent 27bb3de75c
commit 3e1aed8641

View File

@ -1135,6 +1135,9 @@ class common
case 'webp': case 'webp':
$source_image = imagecreatefromwebp($src); $source_image = imagecreatefromwebp($src);
break; break;
case 'avif':
$source_image = function_exists('imagecreatefromavif') ? imagecreatefromavif($src) : null;
break;
} }
// Image valide // Image valide
if ($source_image) { if ($source_image) {
@ -1155,7 +1158,9 @@ class common
case 'image/gif': case 'image/gif':
return (imagegif($virtual_image, $dest)); return (imagegif($virtual_image, $dest));
case 'webp': case 'webp':
$source_image = imagecreatefromwebp($src); return (imagewebp($virtual_image, $dest));
case 'avif':
return (imageavif($virtual_image, $dest));
} }
} else { } else {
return (false); return (false);