Daniel Supernault 4 hónapja
szülő
commit
7ddbe0c473

+ 3 - 1
app/Http/Controllers/Admin/AdminSettingsController.php

@@ -70,6 +70,7 @@ trait AdminSettingsController
             'type_gif' => 'nullable',
             'type_mp4' => 'nullable',
             'type_webp' => 'nullable',
+            'type_avif' => 'nullable',
             'admin_account_id' => 'nullable',
             'regs' => 'required|in:open,filtered,closed',
             'account_migration' => 'nullable',
@@ -128,6 +129,7 @@ trait AdminSettingsController
             'type_gif' => 'image/gif',
             'type_mp4' => 'video/mp4',
             'type_webp' => 'image/webp',
+            'type_avif' => 'image/avif',
         ];
 
         foreach ($mimes as $key => $value) {
@@ -609,7 +611,7 @@ trait AdminSettingsController
         $mediaTypes = $request->input('media_types');
         $mediaArray = explode(',', $mediaTypes);
         foreach ($mediaArray as $mediaType) {
-            if (! in_array($mediaType, ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'video/mp4'])) {
+            if (! in_array($mediaType, ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'video/mp4', 'image/avif'])) {
                 return redirect()->back()->withErrors(['media_types' => 'Invalid media type']);
             }
         }

+ 5 - 1
resources/assets/components/admin/AdminSettings.vue

@@ -1025,6 +1025,10 @@
                         res += 'video/mp4'
                     }
 
+                    if(this.mediaTypes.avif) {
+                        res += 'image/avif'
+                    }
+
                     if(res.endsWith(',')) {
                         res = res.slice(0, -1);
                     }
@@ -1088,7 +1092,7 @@
                 if(types && types.length) {
                     types.forEach((type) => {
                         let mime = type.split('/')[1];
-                        if(['jpeg', 'png', 'gif', 'webp', 'mp4'].includes(mime)) {
+                        if(['jpeg', 'png', 'gif', 'webp', 'mp4', 'avif'].includes(mime)) {
                             this.mediaTypes[mime] = true;
                         }
                     })