up
This commit is contained in:
@@ -129,19 +129,24 @@ class MediaService {
|
||||
|
||||
public function extensionFromMime($mime) {
|
||||
if (!$mime) return null;
|
||||
// Remover parámetros del mime type (ej: "audio/ogg; codecs=opus" -> "audio/ogg")
|
||||
$baseMime = strtolower(trim(explode(';', $mime)[0]));
|
||||
$map = [
|
||||
'image/jpeg' => 'jpg',
|
||||
'image/png' => 'png',
|
||||
'image/gif' => 'gif',
|
||||
'image/webp' => 'webp',
|
||||
'image/svg+xml' => 'svg',
|
||||
'audio/mpeg' => 'mp3',
|
||||
'audio/ogg' => 'ogg',
|
||||
'audio/opus' => 'opus',
|
||||
'audio/opus' => 'ogg',
|
||||
'audio/aac' => 'aac',
|
||||
'audio/amr' => 'amr',
|
||||
'audio/mp4' => 'm4a',
|
||||
'video/mp4' => 'mp4',
|
||||
'video/3gpp' => '3gp',
|
||||
'video/quicktime' => 'mov',
|
||||
'video/webm' => 'webm',
|
||||
'text/csv' => 'csv',
|
||||
'text/plain' => 'txt',
|
||||
'application/pdf' => 'pdf',
|
||||
@@ -153,8 +158,9 @@ class MediaService {
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
|
||||
'application/zip' => 'zip',
|
||||
'application/x-rar-compressed' => 'rar',
|
||||
'application/octet-stream' => 'bin',
|
||||
];
|
||||
return $map[$mime] ?? null;
|
||||
return $map[$baseMime] ?? null;
|
||||
}
|
||||
|
||||
public function isImageMime($mime) {
|
||||
|
||||
Reference in New Issue
Block a user