Skip to content

Commit 07f2e1f

Browse files
committed
reamde
1 parent 05dbb74 commit 07f2e1f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The following example will provide you with a better understanding of the packag
2525

2626
We will create a YouTube-like service, with a model named `Channel`. This `Channel` will have two types of media: `avatar` and `videos`. We will define these media types in the `registerMediaCollections` method.
2727

28-
We want to store the avatars in a square format, with dimensions not exceeding 500px, and in the WebP format. We will accomplish this in the `registerMediaTransformations` method.
28+
We want to store the avatars in a square format, with dimensions not exceeding 500px, and in the WebP format. We will accomplish this in the `transform` parameter.
2929

3030
For each media type, we will need a set of conversions, as illustrated in the following tree:
3131

@@ -42,7 +42,7 @@ For each media type, we will need a set of conversions, as illustrated in the fo
4242
/hls
4343
```
4444

45-
We will define these conversions in the `registerMediaConversions` method.
45+
We will define these conversions in the `conversions` parameter.
4646

4747
Here is how our `Channel` class will be defined:
4848

@@ -124,7 +124,7 @@ class ChannelAvatarController extends Controller
124124
function function store(Request $request, Channel $channel)
125125
{
126126
$channel->addMedia(
127-
file: $file->file('avatar'),
127+
file: $request->file('avatar'),
128128
collectionName: 'avatar',
129129
name: "{$channel->name}-avatar",
130130
)
@@ -260,7 +260,7 @@ php artisan vendor:publish --tag="laravel-media-views"
260260

261261
There are two essential concepts to understand, both of which are associated with the Model and its media:
262262

263-
- **Media Collection**: This defines a group of media with its specific settings (the group can only contain one media item). For example, avatar, thumbnail, and upload are all media collections.
263+
- **Media Collection**: This defines a group of media with its specific settings (the group can only contain one or more media). For example, avatar, thumbnail, and upload are all media collections.
264264

265265
- **Media Conversion**: This defines a file conversion of a particular media item. For instance, a 720p version of a larger 1440p video, a WebP or PNG conversion of an image, are all examples of media conversions. Notably, a media conversion can also have its own media conversions.
266266

@@ -325,11 +325,12 @@ class Channel extends Model implements InteractWithMedia
325325

326326
#### Registering Media Conversions
327327

328-
This package provides common jobs for your conversions to simplify your work:
328+
This package provides common converions to simplify your work:
329329

330-
- `MediaConversionImage`: This job optimizes, resizes, or converts any image using `spatie/image`.
331-
- `MediaConversionVideo`: This job optimizes, resizes, or converts any video using `pbmedia/laravel-ffmpeg`.
332-
- `MediaConversionPoster`: This job extracts a poster using `pbmedia/laravel-ffmpeg`.
330+
- `MediaConversionImage`: This conversion optimizes, resizes, or converts any image using `spatie/image`.
331+
- `MediaConversionVideo`: This conversion optimizes, resizes, or converts any video using `pbmedia/laravel-ffmpeg`.
332+
- `MediaConversionAudio`: This conversion optimizes, resizes, converts or extract any audio using `pbmedia/laravel-ffmpeg`.
333+
- `MediaConversionPoster`: This conversion extracts a poster using `pbmedia/laravel-ffmpeg`.
333334

334335
```php
335336
namespace App\Models;
@@ -393,6 +394,9 @@ class Channel extends Model implements InteractWithMedia
393394
'video/mp4', 'video/webm', 'video/ogg', 'video/quicktime',
394395
],
395396
conversions: [
397+
new MediaConversionAudio(
398+
name: 'audio'
399+
),
396400
new MediaConversionPoster(
397401
name: 'poster'
398402
),

0 commit comments

Comments
 (0)