Skip to content

Commit

Permalink
Refactor code to simplify cover handling in WriterMp3Test.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilan-riviere committed Oct 3, 2024
1 parent 831bf67 commit 7122022
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 174 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,14 @@ use Kiwilan\Audio\Audio;
$audio = Audio::read('path/to/audio.mp3');
$cover = 'path/to/cover.jpg';

$image = getimagesize($cover);
$coverData = file_get_contents($cover);
$coverPicturetypeid = $image[2];
$coverDescription = 'cover';
$coverMime = $image['mime'];

$tag = $audio->write()
->tags([
'title' => 'New Title',
'band' => 'New Band',
'attached_picture' => [
[
'data' => $coverData,
'picturetypeid' => $coverPicturetypeid,
'description' => $coverDescription,
'mime' => $coverMime,
],
],
])
->cover($coverData)
->save();
```

Expand Down
Loading

0 comments on commit 7122022

Please sign in to comment.