LaravelPackages.net
Acme Inc.
Toggle sidebar
omnia-digital/media-manager

A media manager to upload media files to multiple storages or select image from Unsplash, URL

143
6
2.0.0
About omnia-digital/media-manager

omnia-digital/media-manager is a Laravel package for a media manager to upload media files to multiple storages or select image from unsplash, url. It currently has 6 GitHub stars and 143 downloads on Packagist (latest version 2.0.0). Install it with composer require omnia-digital/media-manager. Discover more Laravel packages by omnia-digital or browse all Laravel packages to compare alternatives.

Last updated

Livewire Media Manager

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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:

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"

How to open Media Manager modal

Via Alpinejs

this.$wire.dispatchTo(
    'media-manager',
    'media-manager:show',
    {
        id: 'featured-image',
        file: null,
        metadata: null
    }
);

From Livewire Component

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

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:

x-on:media-manager:file-selected.window="setImage"

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments