Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio/mp3 not working, returning null #20

Open
renjithspace opened this issue Dec 23, 2019 · 3 comments
Open

Audio/mp3 not working, returning null #20

renjithspace opened this issue Dec 23, 2019 · 3 comments

Comments

@renjithspace
Copy link

Code

use Mimey\MimeTypes;

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

Expected

mp3

Output

null
@peter279k
Copy link
Contributor

peter279k commented Dec 23, 2019

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
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants