skylineos/yii-mediamanager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

skylineos/yii-mediamanager

Composer 安装命令:

composer require skylineos/yii-mediamanager

包简介

Yii2 extention using phpleague flysystem

README 文档

README

composer require skylineos/yii-mediamanager:~1.0

Yii2 Configuration

Add the module (per the configuration below) and you should be able to access the Media Manager at /mediamanager

'modules' => [
    ...
    'mediamanager' => [
        'class' => 'skylineos\yii\mediamanager\Module',

        // To control authorization
        'accessRoles' => ['@'],
        
        // Layout if you wish to specify
        'layout' => '@vendor/skylineos/yii/mediamanager/views/layouts/main.php',
        
        // Adapter definitions below - only pick one at a time.
        
        // For AWS S3
        'adapter' => 's3',
        'configuration' => [
            'bucket' => 'my-bucket',
            'region' => 'my-region',
            'prefix' => 'my-prefix',
        ],

        // For local filesystem
        'adapter' => 'local',
        'configuration' => [
            'directory' => 'path/to/your/files',
        ],
    ],
]

Fileinput Widget

To use the media manager as a file input (eg. in an active form):

<?php

use skylineos\yii\mediamanager\widgets\FileInput;
use skylineos\yii\mediamanager\widgets\MediaManagerModal;

?>

<?= FileInput::widget([
    'model' => $model,
    'attribute' => 'image',
    'label' => 'Image',
    ]) ?>

<?= MediaManagerModal::widget([]) ?>    

TinyMce Integration

Integration w/ Tinymce is very similar to the FileInput. TinyMce setup is consistant with the TinyMce official configuration and matches previous previous Yii2 integrations. The example below shows this setup in some detail however, the only point that concerns this integration is 'plugins' => ['media', 'image']. You can configure them on the toolbar however you like.

<?php 

use skylineos\yii\mediamanager\widgets\TinyMce;
use skylineos\yii\mediamanager\widgets\MediaManagerModal;

?>

<?= $form->field($model, 'content')->widget(TinyMce::className(), [
    'options' => ['rows' => 15],
    'clientOptions' => [
        'plugins' => [
            "advlist autolink lists link charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste image"
        ],
        'menubar' => 'edit insert view format table tools help',
        'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
    ]
]); ?>

<?= MediaManagerModal::widget([]) ?>    

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固