xref: /webtrees/app/Mime.php (revision 6d0346fb6717c6bfdc004508a85adf03b89d5468)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2021 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees;
21
22/**
23 * A list of known or supported mime types
24 */
25class Mime
26{
27    public const DEFAULT_TYPE = 'application/octet-stream';
28
29    // Convert extension to mime-type
30    public const TYPES = [
31        'bmp'  => 'image/bmp',
32        'css'  => 'text/css',
33        'doc'  => 'application/msword',
34        'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
35        'ged'  => 'text/x-gedcom',
36        'gif'  => 'image/gif',
37        'flac' => 'audio/flac',
38        'htm'  => 'text/html',
39        'html' => 'text/html',
40        'ico'  => 'image/x-icon',
41        'jpe'  => 'image/jpeg',
42        'jpeg' => 'image/jpeg',
43        'jpg'  => 'image/jpeg',
44        'js'   => 'application/javascript',
45        'json' => 'application/json',
46        'mov'  => 'video/quicktime',
47        'mp3'  => 'audio/mpeg',
48        'mp4'  => 'video/mp4',
49        'oga'  => 'audio/ogg',
50        'ogg'  => 'audio/ogg',
51        'ogv'  => 'video/ogg',
52        'pdf'  => 'application/pdf',
53        'png'  => 'image/png',
54        'rar'  => 'application/x-rar-compressed',
55        'svg'  => 'image/svg+xml',
56        'tif'  => 'image/tiff',
57        'tiff' => 'image/tiff',
58        'txt'  => 'text/plain',
59        'webp' => 'image/webp',
60        'wmv'  => 'video/x-ms-wmv',
61        'xls'  => 'application/vnd-ms-excel',
62        'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
63        'xml'  => 'application/xml',
64        'zip'  => 'application/zip',
65    ];
66}
67