Edit mp3metatag using getid3 in php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Edit mp3metatag using getid3 in php

    Is there anyone who knows how to edit mp3meta tag in php

    PHP Code:
    include("db.php");
    $id=$_REQUEST['id'];
    $query "SELECT * from files where id='".$id."'";
    function 
    scanID3($file)
    {
    require_once 
    'getid3/getid3.php'
    $res false;
    $getID3 = new getID3();
    $id3 $getID3->analyze($file);
    if (isset(
    $id3["fileformat"]) && $id3["fileformat"] == "mp3") {
    $res = array();
    $res["file"] = $file;
    if (isset(
    $id3["tags"]["id3v2"]["artist"][0])) {
    $res["artist"] = $id3["tags"]["id3v2"]["artist"][0];
    } else {
    $res["artist"] = "Unknown";
    }


    if(isset(
    $id3['comments']['picture'][0])){
    $res['image'] = 'data:'.$id3['comments']['picture'][0]['image_mime'].';charset=utf-8;base64,'.base64_encode($id3['comments']['picture'][0]['data']);
    }
    else
    {
    $res['image'] = 'unknown';
    }
    } else {
    //var_dump($file);
    }

    return 
    $res;
    }
    ?> 
Working...
X