Quellcode durchsuchen

上传图片类型

wzq vor 5 Jahren
Ursprung
Commit
fc32bce774
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      app/Http/Controllers/UploadController.php

+ 2 - 2
app/Http/Controllers/UploadController.php

@@ -20,7 +20,7 @@ class UploadController extends Controller
 //            $type=$request->file('image')->getClientMimeType();
 //            //获取文件的绝对路径,但是获取到的在本地不能打开
             $filePath = $request->file('image')->getRealPath();
-            if (in_array($kuoname, ['jpg', 'jpeg', 'png'])) {
+            if (in_array($kuoname, ['jpg', 'gif', 'png'])) {
                 $width = Image::make($filePath)->width();
                 $height = Image::make($filePath)->height();
                 //要保存的文件名 时间+扩展名
@@ -50,7 +50,7 @@ class UploadController extends Controller
             $kuoname = $files[$i]->getClientOriginalExtension();
             $filePath = $files[$i]->getRealPath();
             //要保存的文件名 时间+扩展名
-            if (in_array($kuoname, ['jpg', 'jpeg', 'png'])) {
+            if (in_array($kuoname, ['jpg', 'gif', 'png'])) {
                 $width = Image::make($filePath)->width();
                 $height = Image::make($filePath)->height();
                 //要保存的文件名 时间+扩展名