2017 © Pedro Peláez
 

yii2-extension yii-webuploader

Yii2 extension widget

image

suncky/yii-webuploader

Yii2 extension widget

  • Thursday, November 24, 2016
  • by suncky
  • Repository
  • 0 Watchers
  • 0 Stars
  • 12 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

说明

扩展yii widget 的 上传组件, (*1)

使用样例


config 'components' => [ //本地文件上传 上传到本地 设为uploader 关闭设为 uploader_local 'uploader' => [ 'class' => '\suncky\yii\widgets\webuploader\components\FileManager', 'storage' => [ 'class' => '\suncky\yii\widgets\webuploader\components\Uploader', 'basePath' => ROOT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR, 'baseUrl' => Yii::getAlias('@static'), 'baseDir' => 'uploaded', //'class' => '\suncky\uploader\components\Oss', //'baseUrl' => 'http://.../', //'keyId' => '...', //'keySecret' => '...', //'bucket' => 'xxx-upload', //'endPoint' => isset($_SERVER['SERVER']) && $_SERVER['SERVER'] == 'ALIYUN' ? 'http://oss-cn-hangzhou-internal.aliyuncs.com' : 'http://oss-cn-hangzhou.aliyuncs.com', ], 'rules' => [ 'image' => [ 'class' => 'yii\validators\ImageValidator', ], ] ], 'imageManager' => [ //'class' => '\suncky\yii\widgets\webuploader\components\OssImage', 'class' => '\suncky\uploader\components\Image', 'storage' => [ 'class' => '\suncky\yii\widgets\webuploader\components\Uploader', 'basePath' => ROOT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR, 'baseUrl' => Yii::getAlias('@static'), 'baseDir' => 'uploaded/thumb', // 'class' => 'suncky\yii\widgets\webuploader\components\Oss', // 'baseUrl' => 'http://.../', // 'baseDir' => 'uploaded', // 'keyId' => '...', // 'keySecret' => '...', // 'bucket' => 'xxx-upload', // 'endPoint' => isset($_SERVER['SERVER']) && $_SERVER['SERVER'] == 'ALIYUN' ? 'http://oss-cn-hangzhou-internal.aliyuncs.com' : 'http://oss-cn-hangzhou.aliyuncs.com', ], ], ] controller.php public function actions() { return [ 'image' => ImageUploaderAction::className(), 'attachment' => [ 'class' => AttachmentUploaderAction::className(), //'uploadDir' => 'uploaded' . DIRECTORY_SEPARATOR. 'app', ], ]; } model.php 上传图片 echo $form ->field($model, 'image_id') ->widget(ImageUploader::className(), [ 'template' => "
{pick}\n{upload}\n{items}
", 'uploadOptions' => ['class' => 'uploader-upload'], 'clientOptions' => [ 'fileVal' => 'upimg', 'server' => Url::to(['image']), 'fileNumLimit' => 1 ]]) ->label("上传图片"); 上传附件 echo $form->field($model, 'attachment') ->widget(AttachmentUploader::className(), [ 'template' => "
{pick}\n{upload}\n{items}
", 'uploadOptions' => ['class' => 'uploader-upload'], 'clientOptions' => ['fileVal' => 'upatt', 'server' => Url::to(['attachment']), 'fileNumLimit' => 1 ]]);

The Versions

24/11 2016

dev-master

9999999-dev

Yii2 extension widget

  Sources   Download

GPL2.0

The Requires

 

by Avatar suncky

13/11 2016

1.0.0

1.0.0.0

Yii2 extension widget

  Sources   Download

GPL2.0

The Requires

 

by Avatar suncky