xwl / yii2-avatar
基于hyii2/yii-avatar,修改的符合自己习惯的包
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-27 19:34:55 UTC
README
Avatar Upload
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist xwl/yii2-avatar "*"
or add
"xwl/yii2-avatar": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
//在当前控制器的actions中添加如下配置 public function actions() { return [ 'crop'=>[ 'class' => 'xwl\avatar\CropAction', 'config'=>[ 'bigImageWidth' => '200', //大图默认宽度 'bigImageHeight' => '200', //大图默认高度 'middleImageWidth'=> '100', //中图默认宽度 'middleImageHeight'=> '100', //中图图默认高度 'smallImageWidth' => '50', //小图默认宽度 'smallImageHeight' => '50', //小图默认高度 //头像上传目录(注:目录前不能加"/") 'uploadPath' => 'uploads/avatar', ] ] ]; } <?= \xwl\avatar\AutoloadExample::widget(); ?>