So recently, I submitted a bid on a project to make a lyrics website using
PHP. I haven’t been contacted about whether or not I won the bid yet, but I decided that I might
as well start some preliminary work on backend coding – It’ll make my life easier, and deliver a faster and
better result to the client, so why not?
Why am I mentioning this, you ask?
What does my personal life have to do with my tech blog? Well, I’m getting to that!
almost immediately thought. “Hey, wouldn’t it be really cool if the admin of the website could
simply upload an MP3 file and pull almost, if not all of the data from it to use on the site?” After which,
I quickly searched around for something that would allow me to do just that, to read the ID3 tags on an MP3
The first thing I came to, was the search result on the PHP website for “id3,” the
ID3 PECL Library.
Unfortunately, after trying for a very long time on DreamHost, I not only couldn’t get it to install, but
had just wasted probably an hour in an attempt to. Not only that, but the library was still in its
Some quick internet searching took me to the href="http://getid3.sourceforge.net/">getid3 library, a robust library programmed to read ID3
data tags (and other types of metadata?) from almost any type of file. I quickly set about to
using it, and found its internal structure complicated and confusing. It didn’t even offer me a
quick and easy way to access the album artwork.
After a good period of time learning some
of the basic structure of ID3 and how the getid3 library worked, I set about to coding up a library of my
own to quickly interface with getid3 and retrieve the information I needed.
The result is
class::mp3Data. A very, very simple library
built exclusively to interface with getid3 and retrieve basic information about an mp3 file while still
retaining more advanced information for coders who need it. Take a look at some example code and
the licensing permissions after the break.
Retrieving and Displaying the Artwork as a Picture:style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom:
4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%;
padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr;
max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right:
silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">