承接 omnia-digital/media-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

omnia-digital/media-manager

最新稳定版本:2.0.0

Composer 安装命令:

composer require omnia-digital/media-manager

包简介

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

README 文档

README

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

CleanShot.2022-03-22.at.22.24.51.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.

统计信息

  • 总下载量: 142
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-10