I’m looking for a way to get and change the album cover ID3 tag in my MP3 collection, using PHP. So far I’ve only seen PHP classes that support “normal” text-only ID3 tags, not a single one that allows me to do what I want, which is:
Get the existing album cover in the MP3
If needed, resize it to 200x200px or less (because my MP3 player only supports album covers of this size)
Save the new album cover to the MP3 file.
Step 2 I can easily make on my own, just as long as I have something taking care of the “getting and setting” parts. Anybody know of a class/script/library/whatever that can do this?
You really shouldn’t do such a thing with PHP - a desktop application would be much better, In fact, I made an MP3 album organiser in C# a few months ago. Although PHP CAN do it (google “PHP ID3”), it’s not a multimedia-based language.
If you were to make an online album collection (which I think is illegal), and you want to use PHP, then store everything in a DB, not by files. Windows ID3 tags can get quite annoying on a language that’s based on Linux.
Off Topic:
I may be wrong, but does anyone else smell barcodes?
Yeah, I know PHP isn’t exactly the perfect language for manipulating a sh**load of MP3 files, but I have no ability to write something similar in C#. I know a bit of Java so I’ve been looking into that aswell. I came across some promising libraries which will be my plan B, but still please shout out if you’ve got something PHPish.
I think your best chance is looking for a command line program that does that and exec it from your script.
Or just go the Java route. With a good IDE and a couple of tutorials it won’t take long to write that kind of program. And knowing a bit of Java never hurt anyone.
Look up the ID3 specification to find where in the file to put the image data. Then it’s a simple matter of working your way through the data of the MP3 file and inserting the data where you need it. It’s really not that difficult to do once you understand the file structure of an MP3.
In PHP GD will do the image resizing and the basic file functions will do most of the mp3 file manipulation.