mimey icon indicating copy to clipboard operation
mimey copied to clipboard

Audio/mp3 not working, returning null

Open renjithspace opened this issue 5 years ago • 3 comments

Code

use Mimey\MimeTypes;

$mimes = new MimeTypes();
$extension = $mimes->getExtension('audio/mp3');
echo $extension;

Expected

mp3

Output

null

renjithspace avatar Dec 23 '19 11:12 renjithspace

Hi @renjithspace, thanks for your reply.

Do you refer the mime.types doc?

The audio/mpeg includes following extensions:

# audio/mpa-robust
audio/mpeg					mpga mp2 mp2a mp3 m2a m3a

That is, you have to use following code snippets to accomplish expected behavior:

use Mimey\MimeTypes;
$mimes = new MimeTypes();
$mimes->getExtension('audio/mpeg'); // "mp3"

peter279k avatar Dec 23 '19 12:12 peter279k

If you want to get all extensions for audio/mpeg, using the following method:

$mimes->getAllExtensions('audio/mpeg');

The output array is as follows:

 [
     "mp3",
     "mpga",
     "mp2",
     "mp2a",
     "m2a",
     "m3a",
   ]

peter279k avatar Dec 23 '19 12:12 peter279k

@ralouphie, do you have any idea about this :)?

peter279k avatar Mar 23 '20 16:03 peter279k