定制 ferguson/yii2-upload 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ferguson/yii2-upload

Composer 安装命令:

composer require ferguson/yii2-upload

包简介

upload a file from local to remote server, a widget based on yii2.

README 文档

README

This is a uploaded library with plupload used to upload file.

NOTE: This extension depends on the yiisoft/yii2 extension. Check the composer.json for this extension's requirements and dependencies. PHP environment require fileinfo, if upload files is a image imagick or gd required. imagick is recommend and be priority of use

Why this extension

To ensure upload large files on most browsers, but in addition to plupload, all other plug-ins in use there is a little problem, such as uploadify

Installation

The preferred way to install this extension is through composer.

Note: Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require ferguson/yii2-upload "dev-master"

or add

"ferguson/yii2-upload": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    'modules' => [
        'upload' => [
            'class' => \ferguson\upload\Module::className(),
            'storage' => 'file', // which storage used, default `file` means file will be upload on server. other storages could be supported soon.
            'params' => [
                'dir' => '@webroot', // file upload directory, default `@webroot`, you can customer.
                'url' => '@web', // file uploaded host, default `@web`, you can customer.
                'resize' => [
                    'width' => '90',
                    'height' => '120',
                ], // thumb images size.
                'watermark' => [
                    'type' => ['font', 'image'], //null|string|array, which water type, single or both or none.
                    'position' => '',
                    //font water setting.
                    'font' => [
                        'ttf' => '',
                        'text' => '',//string, water text.
                        'size' => '10',// font size, default 10px
                    ],
                    //image water setting.
                    'image' => [
                        'src' => '', //string, water image path, absolute path.
                        'size' => ''
                    ], 
                ],
            ],
        ],
        //...
    ],
    //...
];

use in view pages.

use ferguson\upload\Upload;

//Normal with ActiveForm & model
echo $form->field($model, 'logo')->widget(Upload::className(), [
    'clientOptions' => [
        'type' => Upload::TYPE_IMAGE,
        'max_size' => '2mb',
    ]
]);

License

yii2-upload is released under the MIT License. See the bundled LICENSE.md for details.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固