wzq 5 anni fa
parent
commit
f3c10732ce
2 ha cambiato i file con 16 aggiunte e 15 eliminazioni
  1. 4 3
      app/Http/Controllers/UeditorController.php
  2. 12 12
      public/config.json

+ 4 - 3
app/Http/Controllers/UeditorController.php

@@ -24,7 +24,8 @@ class UeditorController extends Controller
             case 'uploadimage':
 
                 if($request->hasFile('upfile') && $request->file('upfile')->isValid()){
-                    $path = $request->has('path') ? $request->path.'/' : date('Ym').'/';
+//                    $path = $request->has('path') ? $request->path.'/' : date('Ym').'/';
+                    $path = $request['path'] ? $request['path'].'/' : date('Ym').'/';
                     //获取文件的原文件名 包括扩展名
                     $yuanname= $request->file('upfile')->getClientOriginalName();
                     $size = $request->file('upfile')->getSize();
@@ -36,8 +37,8 @@ class UeditorController extends Controller
                     $filename=time() . '_' . uniqid() .'.'.$kuoname;
 
                     $img = Image::make($filePath);
-                    if ($img->getWidth()>720) {
-                        $img->resize(720, null, function ($constraint) {
+                    if ($img->getWidth()>480) {
+                        $img->resize(480, null, function ($constraint) {
                             $constraint->aspectRatio();
                         });
                         $img->encode('jpg', 90);

+ 12 - 12
public/config.json

@@ -10,18 +10,18 @@
     "imageInsertAlign": "none", /* 插入的图片浮动方式 */
     "imageUrlPrefix": "", /* 图片访问路径前缀 */
     "imagePathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
-                                /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
-                                /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
-                                /* {time} 会替换成时间戳 */
-                                /* {yyyy} 会替换成四位年份 */
-                                /* {yy} 会替换成两位年份 */
-                                /* {mm} 会替换成两位月份 */
-                                /* {dd} 会替换成两位日期 */
-                                /* {hh} 会替换成两位小时 */
-                                /* {ii} 会替换成两位分钟 */
-                                /* {ss} 会替换成两位秒 */
-                                /* 非法字符 \ : * ? " < > | */
-                                /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
+    /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
+    /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
+    /* {time} 会替换成时间戳 */
+    /* {yyyy} 会替换成四位年份 */
+    /* {yy} 会替换成两位年份 */
+    /* {mm} 会替换成两位月份 */
+    /* {dd} 会替换成两位日期 */
+    /* {hh} 会替换成两位小时 */
+    /* {ii} 会替换成两位分钟 */
+    /* {ss} 会替换成两位秒 */
+    /* 非法字符 \ : * ? " < > | */
+    /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
 
     /* 涂鸦图片上传配置项 */
     "scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */