A TALL Stack Media Manager to upload media files to multiple storages or select image from Unsplash, URL
CleanShot.2022-03-22.at.22.24.51.mp4
You can install the package via composer:
composer require omnia-digital/media-manager
Add Tailwind CSS classes in tailwind.config.js
:
module.exports = {
content: [
...
'./vendor/omnia-digital/media-manager/resources/views/**/*.blade.php',
]
};
You can publish the config file with:
php artisan vendor:publish --tag="media-manager-config"
This is the contents of the published config file:
return [
'storage' => [
'disk' => 'public'
],
'image' => [
'allowed_file_types' => ['png', 'jpg', 'jpeg', 'gif'],
/*
* Max file size in KB.
*/
'max_file_size' => 5000,
],
'unsplash' => [
'access_key' => env('UNSPLASH_ACCESS_KEY'),
'utm_source' => env('APP_NAME')
]
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="media-manager-views"
this.$wire.dispatchTo(
'media-manager',
'media-manager:show',
{
id: 'featured-image',
file: null,
metadata: null
}
);
use Omnia\MediaManager\WithMediaManager;
...
public function showUploader()
{
$this->showFileManager('featured-image', $file, $metadata);
}
You can pass file URL as 2nd parameter so the Media Manager will show that file by default.
use Omnia\MediaManager\WithMediaManager;
...
public function removeFeaturedImage()
{
$this->image = null;
$this->removeFileFromMediaManager();
}
File Selected
When a media file is selected, it will dispatch an event, called media-manager:file-selected
You can listen on that event by using AlpineJS like this:
x-on:media-manager:file-selected.window="setImage"
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.