Skip to content

Commit

Permalink
GITBOOK-13: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaznv authored and gitbook-bot committed Dec 27, 2024
1 parent bedc060 commit b27b04c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Moreover, Larupload can calculate the dominant colors of videos and images, as w
* Extract the width and height of the image
* Extract width, height, and duration of the video
* Extract the duration of the audio
* Convert audio file formats
* Extract dominant color from the image and video
* Automatically create a cover image for video files
* Possibility to upload a cover for every file
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced-usage/attachment/complete-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class Media extends Model
->image('thumbnail', 250, 250, LaruploadMediaStyle::AUTO)
->image('crop_mode', 1100, 1100, LaruploadMediaStyle::CROP)
->image('portrait_mode', 1000, 1000, LaruploadMediaStyle::SCALE_WIDTH)
->audio('audio_wav', new Wav())
->audio('audio_flac', new Flac())
->audio('audio_aac', new Aac())
->audio(
name: 'audio_mp3',
format: (new Mp3())->setAudioKiloBitrate(192)->setAudioChannels(2)
)
->video('thumbnail', 250, 250, LaruploadMediaStyle::AUTO)
->video('crop_mode', 1100, 1100, LaruploadMediaStyle::CROP)
->video('portrait_mode', 1000, 1000, LaruploadMediaStyle::SCALE_WIDTH)
Expand Down
37 changes: 37 additions & 0 deletions docs/advanced-usage/attachment/media-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,43 @@ class Media extends Model





### Audio Style

<table><thead><tr><th width="103" data-type="number">Index</th><th width="99">Name</th><th width="196">Type</th><th data-type="checkbox">Required</th><th width="155">Default</th><th width="515">Description</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>string</td><td>true</td><td>–</td><td>style name. examples: hq, lq, ...</td></tr><tr><td>2</td><td>format</td><td>Mp3|Aac|Wav|Flac</td><td>false</td><td>Mp3</td><td>the format of the converted audio file</td></tr></tbody></table>

```php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Mostafaznv\Larupload\Enums\LaruploadMediaStyle;
use Mostafaznv\Larupload\Storage\Attachment;
use Mostafaznv\Larupload\Traits\Larupload;
use FFMpeg\Format\Audio\Wav;

class Media extends Model
{
use Larupload;

public function attachments(): array
{
return [
Attachment::make('file')
->audio('hq', new Wav())
];
}
}
```







### Video Style

<table><thead><tr><th width="103" data-type="number">Index</th><th width="99">Name</th><th width="196">Type</th><th data-type="checkbox">Required</th><th width="155">Default</th><th width="515">Description</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>string</td><td>true</td><td>–</td><td>style name. examples: thumbnail, small, ...</td></tr><tr><td>2</td><td>width</td><td>?int</td><td>false</td><td>null</td><td>width of the manipulated video</td></tr><tr><td>3</td><td>height</td><td>?int</td><td>false</td><td>null</td><td>height of the manipulated video</td></tr><tr><td>4</td><td>mode</td><td>LaruploadMediaStyle</td><td>false</td><td>SCALE_HEIGHT</td><td>this argument specifies how Larupload should manipulate the uploaded video and can take on any of the following values: <code>FIT</code>, <code>AUTO</code>, <code>SCALE_WIDTH</code>, <code>SCALE_HEIGHT</code>, <code>CROP</code></td></tr><tr><td>5</td><td>format</td><td>X264</td><td>false</td><td>new X264</td><td>by default, the encoding format for video is <code>X264</code>. However, users can specify additional options for this format, including adjusting the <code>kilobitrate</code> for both <code>audio</code> and <code>video</code>. This allows for more precise configuration and optimization of the user's encoding preferences.</td></tr><tr><td>6</td><td>padding</td><td>bool</td><td>false</td><td>false</td><td>If set to <code>true</code>, padding will be applied to the video using a black color in order to fit the given dimensions.</td></tr></tbody></table>
Expand Down
13 changes: 5 additions & 8 deletions docs/cover/upload-cover.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

In Larupload, covers are associated with the original files and must be uploaded using the `attach()` function. When uploading a file, you can also include a cover as the second argument. If a cover is provided, it will be assigned to the uploaded file and the [automatic cover creation](#user-content-fn-1)[^1] by the package will be prevented.

<pre class="language-php"><code class="lang-php">$file = $request->file('file');
```php
$file = $request->file('file');
$cover = $request->file('cover');
# or
$upload->attachment('file')->attach($file, $cover);

<a data-footnote-ref href="#user-content-fn-2">$upload->attachment('file')->attach($file, $cover);</a>
$upload->save();
</code></pre>
```





[^1]: it's only available for image and videos

[^2]: ```php
# or
$upload->file->attach($file, $cover);
```
1 change: 1 addition & 0 deletions docs/standalone-uploader/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $upload = Larupload::init('path')
->namingMethod(LaruploadNamingMethod::HASH_FILE)
->image('thumbnail', 1000, 750, LaruploadMediaStyle::CROP)
->video('thumbnail', 1000, 750, LaruploadMediaStyle::CROP)
->audio('wav', new Wav())
->stream(
name: '480p',
width: 640,
Expand Down

0 comments on commit b27b04c

Please sign in to comment.