mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-03-13 23:49:13 +00:00
Add AVIF support
This commit is contained in:
parent
102e11c530
commit
7ddbe0c473
2 changed files with 8 additions and 2 deletions
|
@ -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']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue