Images and other questions.

The place for "I can't figure out how to..." questions.
Post Reply
LeeStewart
User
Posts: 1
Joined: Wed Sep 13, 2006 5:02 pm

Images and other questions.

Post by LeeStewart » Wed Sep 13, 2006 6:58 pm

I've got a website that lets a user maintain ID3 tags using GetID3() version 1.7.5 and I have a couple of questions.

1) I want to read the images/album art with the following code:

Code: Select all

if (!empty($fileinfo['id3v2'])) {
    if (@count(@$fileinfo['id3v2']['APIC'][0]['data'])) {
        $out['image_data'] = @$fileinfo['id3v2']['APIC'][0]['data'];
        $out['image_mime'] = @$fileinfo['id3v2']['APIC'][0]['mime'];

    } else if (@count(@$fileinfo['id3v2']['PIC'][0]['data'])) {
        $out['image_data'] = @$fileinfo['id3v2']['PIC'][0]['data'];
        $out['image_mime'] = @$fileinfo['id3v2']['PIC'][0]['image_mime'];
    }
}
This seems to work for most test cases I have, but is that the correct way to handle the data? Is the mime type in different fields for PIC and APIC?

2) Sometimes I get an invalid mime type, for example when there's a PNG attached as album art - the image_mime field is only PNG instead of 'image/png'.

3) When the user changes a tag, I only want to update that one tag - not overwrite all the other information that's in the file. I tried setting $tagwriter->overwrite_tags = false, but I get an error:
Invalid Text Encoding in TITLE (T) for ID3v2.4
$this->GenerateID3v2FrameData() failed for "TITLE"
$this->GenerateID3v2Tag() failed
4) Is it true that using UTF-8 breaks an MP3 file? I discovered that writing tags with UTF-8 causes the file to be unreadable in some programs (like Windows Media Player).


Thanks for any info!
Lee

Post Reply