【问题标题】:How change mp3 tag and photos with PHP?如何使用 PHP 更改 mp3 标签和照片?
【发布时间】:2013-12-05 10:52:15
【问题描述】:

如何用php修改MP3图片?

我使用 id3_get

但在演示中找不到更改照片

【问题讨论】:

    标签: php tags mp3 photo


    【解决方案1】:
    【解决方案2】:

    就我而言,我使用作曲家。

    composer require james-heinrich/getid3
    

    index.php 文件

    <?php
    require __DIR__.'/vendor/autoload.php';
    
    $getID3 = new getID3;
    
    $tagwriter                      = new getid3_writetags;
    $tagwriter->filename            = './music.mp3';
    $tagwriter->tagformats          = array('id3v1','id3v2.3');
    $tagwriter->overwrite_tags      = true;
    $tagwriter->remove_other_tags   = true;
    $tagwriter->tag_encoding        = 'UTF-8';
    $pictureFile = file_get_contents("logo.png");
    
    $TagData = array(
        'title'             => array('My Title'),
        'artist'            => array('My Artist'),
        'attached_picture'  => array(
            array (
                'data'          => $pictureFile,
                'picturetypeid' => 3,
                'mime'          => 'image/png',
                'description'   => 'My Picture'
            )
        )
    );
    
    $tagwriter->tag_data = $TagData;
    
    if ($tagwriter->WriteTags()){
        return true;
    }else{
        throw new \Exception(implode(' : ', $tagwriter->errors));
    }
    ?>
    

    【讨论】:

      猜你喜欢
      • 2011-08-19
      • 2013-04-25
      • 2019-10-09
      • 2010-11-23
      • 1970-01-01
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多