定制 ffchen/webuploader 二次开发

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

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

ffchen/webuploader

Composer 安装命令:

composer require ffchen/webuploader

包简介

desc

README 文档

README

yii2 webuploader 上传widget 可拖动图片排序

安装

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

//更新


使用

控制器

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(); ?>

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

            //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);

一张效果图

image

不足之处请见谅

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固