2017 © Pedro Peláez
 

library webuploader

desc

image

ffchen/webuploader

desc

  • Friday, June 23, 2017
  • by ffchen1227
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 5 % Grown

The README.md

yii2webuploaders

yii2 webuploader 上传widget 可拖动图片排序, (*1)

安装

$ php composer.phar require ffchen/webuploader "*"

//更新


使用, (*2)


控制器, (*3)


public function actions()

   {
        return [
          'uploads'=>[
                'class' => 'ffchen\webuploader\UploadAction',
                'config' => [
                    'imagePathFormat' => Yii::getAlias('@web')."/image/{yyyy}{mm}{dd}/{time}{rand:6}",
                ]
            ]
        ];
    }

<?php $form = ActiveForm::begin(); ?>

   <?= $form->field($model, 'label_img')->widget('ffchen\webuploader\FileInput',[
         'type' => 'images',//多图上传 不写或者写image 为单图
         'config'=>[
            //图片上传的一些配置,不写调用默认配置
            'domain_url' => 'http://www.github.com.com',
        ]
    ]) ?>


<?php ActiveForm::end(); ?>

如果是多图情况在保存入库下把字段序列化后保存例如, (*4)

            //Create
            $imaes = explode(',',Yii::$app->request->post()['Imag']['srcs']);
            for($index=0;$index<count($imaes);$index++)
            {
                $imaes[$index];
            }
            $model->srcs = serialize($imaes);


            //Update
            $imaes = explode(',',Yii::$app->request->post()['Imag']['srcs']);
            for($index=0;$index<count($imaes);$index++)
            {
                $imaes[$index];
            }
            $model->srcs = serialize($imaes);

一张效果图, (*5)

image, (*6)


不足之处请见谅, (*7)

The Versions

23/06 2017

dev-master

9999999-dev

desc

  Sources   Download

MIT

by ffchen

08/06 2017

1.0.1

1.0.1.0

desc

  Sources   Download

MIT

by ffchen

08/06 2017

1.0.0

1.0.0.0

利用webuploader 的小部件 多图上传可拖动排序位置

  Sources   Download

MIT

by ffchen

extension yii2 webuploader