emnabs/yii2-jcrop 问题修复 & 功能扩展

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

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

emnabs/yii2-jcrop

最新稳定版本:v1.0.3

Composer 安装命令:

composer require emnabs/yii2-jcrop

包简介

yii2 image cropping extension

README 文档

README

Yii2 image cropping extension

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist emnabs/yii2-jcrop "*"

or add

"emnabs/yii2-jcrop": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use emnabs\jcrop\Jcrop;
<?= $form->field($model, 'avatar')->widget(Jcrop::className(), [
    'uploadUrl' => Url::toRoute('/user/avatar'),
])->label(false) ?>

Widget has following properties:

Name Description Default Required
uploadParameter Upload parameter name file No
width The final width of the image after cropping 200 No
height The final height of the image after cropping 200 No
uploadUrl URL for uploading and cropping image Yes
maxSize The maximum file size (b). 2097152 No
cropAreaWidth Width box for preview 300 No
cropAreaHeight Height box for preview 300 No
extensions Allowed file extensions (string). jpeg, jpg, png, gif No

In UserController:

    public function actions()
    {
        return [
            'avatar' => [
                'class' => 'emnabs\jcrop\actions\Upload',
                'url' => '/common/files/',
                'path' => Yii::getAlias('@files'),
                'name' => Yii::$app->user->id
            ]
        ];
    }

Action has following parameters:

Name Description Default Required
path Path for saving image after cripping Yes
url URL to which the downloaded images will be available. Yes
name uploded file name. No
uploadParameter Upload parameter name. It must match the value of a similar parameter of the widget. file No
maxSize The maximum file size (b). It must match the value of a similar parameter of the widget. 2097152 No
extensions Allowed file extensions (string). It must match the value of a similar parameter of the widget. jpeg, jpg, png, gif No
width The final width of the image after cropping. It must match the value of a similar parameter of the widget. 200 No
height The final height of the image after cropping. It must match the value of a similar parameter of the widget. 200 No

Operates as follows:

screenshot screenshot

License

yii2-jcrop is an open source project modified by Ehsan Rezaei(http://www.developit.ir) that is licensed under GPL-3.0. used and modified from https://github.com/rezaei121/yii2-jcrop

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2019-03-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固