Browse Source

Add support *.avif

Visman 3 năm trước cách đây
mục cha
commit
a91a383df0
2 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 2 0
      app/Core/Files.php
  2. 3 0
      app/Core/Image.php

+ 2 - 0
app/Core/Files.php

@@ -47,6 +47,7 @@ class Files
         'image/webp' => 'webp',
 # non-standard mime types
         'image/x-ms-bmp' => 'bmp',
+        'image/avif' => 'avif',
     ];
 
     /**
@@ -830,6 +831,7 @@ class Files
         'x-conference/x-cooltalk' => 'ice',
 # non-standard mime types
         'image/x-ms-bmp' => 'bmp',
+        'image/avif' => 'avif',
     ];
 
     public function __construct(/* string|int */ $maxFileSize, /* string|int */ $maxImgSize)

+ 3 - 0
app/Core/Image.php

@@ -142,6 +142,9 @@ class Image extends File
             case 'webp':
                 $result = \imagewebp($this->image, $path, $this->quality);
                 break;
+            case 'avif':
+                $result = \imageavif($this->image, $path, $this->quality);
+                break;
             default:
                 $this->error = 'File type not supported';