瀏覽代碼

Add support *.avif

Visman 3 年之前
父節點
當前提交
a91a383df0
共有 2 個文件被更改,包括 5 次插入0 次删除
  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';