@@ 114-135 (lines=22) @@ | ||
111 | * @param string $type The MIME type to resolve. |
|
112 | * @return string|null The extension based on the MIME type. |
|
113 | */ |
|
114 | protected function resolveExtensionFromMimeType($type) |
|
115 | { |
|
116 | switch ($type) { |
|
117 | case 'audio/mp3': |
|
118 | case 'audio/mpeg': |
|
119 | return 'mp3'; |
|
120 | ||
121 | case 'audio/ogg': |
|
122 | return 'ogg'; |
|
123 | ||
124 | case 'audio/webm': |
|
125 | return 'webm'; |
|
126 | ||
127 | case 'audio/wav': |
|
128 | case 'audio/wave': |
|
129 | case 'audio/x-wav': |
|
130 | case 'audio/x-pn-wav': |
|
131 | return 'wav'; |
|
132 | } |
|
133 | ||
134 | return null; |
|
135 | } |
|
136 | } |
|
137 |
@@ 290-312 (lines=23) @@ | ||
287 | * @param string $type The MIME type to resolve. |
|
288 | * @return string|null The extension based on the MIME type. |
|
289 | */ |
|
290 | protected function resolveExtensionFromMimeType($type) |
|
291 | { |
|
292 | switch ($type) { |
|
293 | case 'image/gif': |
|
294 | return 'gif'; |
|
295 | ||
296 | case 'image/jpg': |
|
297 | case 'image/jpeg': |
|
298 | case 'image/pjpeg': |
|
299 | return 'jpg'; |
|
300 | ||
301 | case 'image/png': |
|
302 | return 'png'; |
|
303 | ||
304 | case 'image/svg+xml': |
|
305 | return 'svg'; |
|
306 | ||
307 | case 'image/webp': |
|
308 | return 'webp'; |
|
309 | } |
|
310 | ||
311 | return null; |
|
312 | } |
|
313 | ||
314 | /** |
|
315 | * @param mixed $val The value, at time of saving. |