Przeglądaj źródła

上传接口不在计算长宽

xielin 5 lat temu
rodzic
commit
d504fb6e79
1 zmienionych plików z 8 dodań i 8 usunięć
  1. 8 8
      app/Http/Controllers/UploadController.php

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

@@ -18,16 +18,16 @@ class UploadController extends Controller
             $filePath = $request->file('image')->getRealPath();
             Log::debug('文件类型'.$kuoname);
             try{
-                if (in_array($kuoname, ['jpg', 'jpeg', 'gif', 'png'])) {
-                    $width = Image::make($filePath)->width();
-                    $height = Image::make($filePath)->height();
-                    //要保存的文件名 时间+扩展名
-                    $filename = time() . '_' . uniqid() . '.' . $kuoname;
-                    $fileurl = $filename . '?' . $width . '_' . $height;
-                } else {
+//                if (in_array($kuoname, ['jpg', 'jpeg', 'gif', 'png'])) {
+//                    $width = Image::make($filePath)->width();
+//                    $height = Image::make($filePath)->height();
+//                    //要保存的文件名 时间+扩展名
+//                    $filename = time() . '_' . uniqid() . '.' . $kuoname;
+//                    $fileurl = $filename . '?' . $width . '_' . $height;
+//                } else {
                     //要保存的文件名 时间+扩展名
                     $fileurl = $filename = time() . '_' . uniqid() . '.' . $kuoname;
-                }
+//                }
                 $imageUrl = Storage::put($path . $filename, file_get_contents($filePath));
                 Log::debug('upload_url:' . $imageUrl);
                 if ($imageUrl) {