setting album art of a mp3 with php

前端 未结 9 1804
花落未央
花落未央 2021-01-04 16:04

I am looking for the best or any way to set the Album Art of mp3s using PHP.

Suggestions?

9条回答
  •  生来不讨喜
    2021-01-04 16:46

    Here is the basic code for adding an image and ID3 data using getID3. (@frostymarvelous' wrapper includes equivalent code, however I think that it is helpful to show the basics.)

    filename = 'audiofile.mp3';
        $tagwriter->tagformats = array('id3v2.3');
        $tagwriter->overwrite_tags    = true;
        $tagwriter->remove_other_tags = true;
        $tagwriter->tag_encoding      = $TextEncoding;
    
        $pictureFile=file_get_contents("image.jpg");
    
        $TagData = array(
            'title' => 'My Title',
            'artist' => 'My Artist',        
            'attached_picture' => array(   
                array (
                    'data'=> $pictureFile,
                    'picturetypeid'=> 3,
                    'mime'=> 'image/jpeg',
                    'description' => 'My Picture'
                )
            )
        );
    ?>
    

提交回复
热议问题