Coder Social home page Coder Social logo

php-mp3-editor's Introduction

PHP-MP3-Editor

get or change music tags and cover or trim it very easy

intro

this is a small library for easy using of getid3 and phpmp3 libraries.

instalition

get a clone of project and use this code

require '/path/to/PHP-MP3-Editor/php-mp3-editor.php';
$mp3 = new mp3editor();

Methods

tags

tags(string $path)

get mp3 file tags as a clean array

$mp3 = new mp3editor();
$tags = $mp3->tags('/my/file.mp3');

cover

cover(string $path,string|false $saveto = false)

get content of music cover file . you can also with using $saveto parameter use a path to save cover content into a image file

$mp3 = new mp3editor();

/// get content of cover
$cover = $mp3->cover('/my/file.mp3');
/// save cover as separately
file_put_contents("/a/path/file.png",file_get_contents($cover);

/// get cover content and save into a path
$cover = $mp3->cover('/my/file.mp3','/cover/path/file.jpg');

tagEdit

tagEdit(string $path,array $data)

replace any tags into a mp3 file very simple

$mp3 = new mp3editor();
$new_tags = [
  "title"  => "new title",
  "artist" => "any artist name",
  "cover"  => "/a/picture.jpg"
];
$mp3->tagEdit('/my/file.mp3',$new_tags);

trim

trim(string $path,int $offset,int $limit,string|false $saveto = false)

trim a mp3 file and save it as overwrite or into another path if dont use $saveto parameter it means you want trim and overwrite mp3 file

$mp3 = new mp3editor();
$start_secound = 20;
$trim_time_secounds = 40;
/// it means method trims music from 0:20 to 1:00
$mp3->trim('/my/file.mp3',$start_secound,$trim_time_secounds,'/new/path.mp3');

php-mp3-editor's People

Contributors

farazfathi avatar shadmehr-gh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.