Skip to content

Commit

Permalink
GITBOOK-14: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaznv authored and gitbook-bot committed Dec 28, 2024
1 parent 164c1d1 commit 5f6aeff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Moreover, Larupload can calculate the dominant colors of videos and images, as w
* Upload with 2 different strategies: ORM-based and Standalone
* Use different drivers
* Ability to resize/crop photos and videos
* Ability to convert video files into custom video or audio formats
* Ability to create multiple sizes of videos and images
* Ability to create HTTP Live Streaming (HLS) from video sources
* Ability to hide the real ID of model records by using different ID formats (ULID, UUID and ...)
Expand Down
5 changes: 5 additions & 0 deletions docs/advanced-usage/attachment/complete-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

namespace App\Models;

use FFMpeg\Format\Audio\Flac;
use FFMpeg\Format\Audio\Mp3;
use FFMpeg\Format\Audio\Wav;
use FFMpeg\Format\Video\X264;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
Expand All @@ -17,6 +20,7 @@ use Mostafaznv\Larupload\Enums\LaruploadSecureIdsMethod;
use Mostafaznv\Larupload\Storage\Attachment;
use Mostafaznv\Larupload\Traits\Larupload;


class Media extends Model
{
use Larupload;
Expand Down Expand Up @@ -51,6 +55,7 @@ class Media extends Model
->video('thumbnail', 250, 250, LaruploadMediaStyle::AUTO)
->video('crop_mode', 1100, 1100, LaruploadMediaStyle::CROP)
->video('portrait_mode', 1000, 1000, LaruploadMediaStyle::SCALE_WIDTH)
->video(name: 'mp3', format: new Mp3)
->video(
name: 'auto',
width: 300,
Expand Down
5 changes: 4 additions & 1 deletion docs/advanced-usage/attachment/media-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Media extends Model

### 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>
<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 | WebM | Ogg | Mp3 | Aac | Wav | Flac</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 <code>video</code>/<code>audio</code>formats and options, 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>

```php
<?php
Expand All @@ -95,6 +95,8 @@ use Illuminate\Database\Eloquent\Model;
use Mostafaznv\Larupload\Enums\LaruploadMediaStyle;
use Mostafaznv\Larupload\Storage\Attachment;
use Mostafaznv\Larupload\Traits\Larupload;
use FFMpeg\Format\Audio\Mp3;


class Media extends Model
{
Expand All @@ -106,6 +108,7 @@ class Media extends Model
Attachment::make('file')
->video('thumbnail', 250, 250, LaruploadMediaStyle::CROP)
->video('landscape', 1100, 1100, LaruploadMediaStyle::AUTO)
->video(name: 'mp3', format: new Mp3)
];
}
}
Expand Down

0 comments on commit 5f6aeff

Please sign in to comment.