Home php How to pull the cover from audio recordings?

How to pull the cover from audio recordings?

Author

Date

Category

In VKontakte there are audio recordings that are displayed with covers:

 Enter here a description of the image

I want to do the same for the player on my site. If someone downloads some kind of music, then if possible, display the cover. But how can this be done? Initially, I planned to pull out the name of the artist’s name and the name of the song from the meta data file, make a search in the Google Cartigns in the file name_name_Track Album Cover , and take the first picture. But after all, such a request may be displayed, for example, the cover of some other album of the same artist. And I need accuracy. How can I implement such a mechanism? In a MP3 container, as I understood, the data is not stored on the performer, nor the album cover.


Answer 1, Authority 100%

Try using getId3

& lt;? php
 $ Path = "MP3 FILE PATH";
 $ GetId3 = New GetId3;
 $ OldthisfileInfo = $ getId3- & gt; Analyze ($ Path);
 IfthisfileInfo ['COMMENTS'] ['Picture'] [0])) {
   $ Image = 'Data:'. $ Oldthisfileinfo ['comments'] ['Picture'] [0] ['image_mime']. '; Charset = UTF-8; Base64,'. Base64_ENCode ($ oldthisfileinfo ['Comments'] ['Picture'] [0] ['Data']);
 }
 ? & gt;
 & lt; img id = "fileimage" width = "150" src = "& lt;? php echo @ $ image;? & gt;" Height = "150" & gt;

This code insert a picture in HTML in base64

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions