Hello. I would like when users downloaded music (.mp3) from my site and added a cover (watermark) photo to it.
Even his music and no. I have seen it in several sites. Is it possible to organize it? I think it is being written through php but I am the front end and I don’t understand it) Thank you all for the answers
- You need a library that can work with ID3 metadata of tracks not lower than ID3v2 version. The standard library does not know this, there is only up to ID3v1, so look for third-party PHP libraries. - Alex Krass
|
1 answer
C using the library getid3.sourceforge.net , approximately:
$data = [ 'attached_picture'=>[ 0=>[ 'description'=>'My best music', 'mime'=>'image/jpeg', 'data'=>file_get_contents('Path/To/Image.jpeg'), 'picturetypeid'=>0x03 ] ] ]; $writer = new \GetId3\Write\Tags; $writer->filename = "path/to/music.mp3"; $writer->tag_encoding = 'UTF-8'; $writer->tagformats = ['id3v2.3', 'id3v1']; $writer->overwrite_tags = true; $writer->tag_data = $data; if ($writer->WriteTags()) echo "Тег успешно обновлен\n"; else throw new \Exception(implode(' : ', $writer->errors)); |