PHP-ID3 icon indicating copy to clipboard operation
PHP-ID3 copied to clipboard

getImage not working

Open Max201 opened this issue 10 years ago • 5 comments

When i try to file_puts_content result of getImage() this is not working. Images are broken.

Max201 avatar Jan 12 '15 10:01 Max201

getImage() returns an array of mimeType and binary data. Are you sure you are outputting the binary data with correct mime type? If yes, can you describe the mp3 file you are having problem with.

shubhamjain avatar Jan 13 '15 07:01 shubhamjain

All mp3-files are incorrect analyzing.

$reader = getId3Tag...; list($mime, $image) = $reader->getImage(); file_put_contents('test.png', $image);

And file test.png is broken.

Max201 avatar Jan 14 '15 08:01 Max201

Correct me if wrong, but you are trying to output it in "PNG" format without considering the MIME type. The library performs no conversions and the images can only be outputted in the format they have been stored.

shubhamjain avatar Jan 14 '15 08:01 shubhamjain

They have been stored in format image/png. I know this, because i try export this with other library that works fine.

Max201 avatar Jan 14 '15 09:01 Max201

@shubhamjain , @Max201 is right the binary file reader returns image data skipping the first byte. Check it on your hex editor. In example for image/jpg files start the file at 0xD8 [..] instead of 0xFF 0xD8

specktator avatar Aug 30 '15 22:08 specktator