https://github.com/omnia-digital/media-manager
A media manager to upload media files to multiple storages or select image from Unsplash, URL
https://github.com/omnia-digital/media-manager
Last synced: 2 months ago
JSON representation
A media manager to upload media files to multiple storages or select image from Unsplash, URL
- Host: GitHub
- URL: https://github.com/omnia-digital/media-manager
- Owner: omnia-digital
- License: mit
- Created: 2023-03-30T03:02:00.000Z (about 2 years ago)
- Default Branch: dev
- Last Pushed: 2023-09-30T22:04:28.000Z (over 1 year ago)
- Last Synced: 2025-04-11T04:06:35.576Z (2 months ago)
- Language: PHP
- Size: 46.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Livewire Media Manager
[](https://packagist.org/packages/omnia-digital/media-manager)
[](https://github.com/omnia-digital/media-manager/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/omnia-digital/media-manager/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[](https://packagist.org/packages/omnia-digital/media-manager)A TALL Stack Media Manager to upload media files to multiple storages or select image from Unsplash, URL
https://user-images.githubusercontent.com/6707194/160046199-91dd3aa3-7687-4394-808e-18057cf5bdbc.mp4
## Installation
You can install the package via composer:
```bash
composer require omnia-digital/media-manager
```Add Tailwind CSS classes in `tailwind.config.js`:
```js
module.exports = {
content: [
...
'./vendor/omnia-digital/media-manager/resources/views/**/*.blade.php',
]
};
```You can publish the config file with:
```bash
php artisan vendor:publish --tag="media-manager-config"
```This is the contents of the published config file:
```php
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
```bash
php artisan vendor:publish --tag="media-manager-views"
```## How to open Media Manager modal
### Via Alpinejs
```js
this.$wire.dispatchTo(
'media-manager',
'media-manager:show',
{
id: 'featured-image',
file: null,
metadata: null
}
);
```### From Livewire Component
```php
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.
## Remove File from Media Manager
```php
use Omnia\MediaManager\WithMediaManager;...
public function removeFeaturedImage()
{
$this->image = null;$this->removeFileFromMediaManager();
}
```## Events
**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:
```js
x-on:media-manager:file-selected.window="setImage"
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Josh Torres](https://github.com/joshtorres)
- [phucle](https://github.com/phuclh)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.