laravel图片上传中的502错误的网关错误

时间:2020-04-28 13:49:41

标签: php laravel

我正在使用“干预/图像;用于上传图片的软件包。尝试上传10 mb jpeg之类的大文件时遇到502错误网关错误,该文件托管在AWS apache服务器中 这是mycode

$image = $request->file('idTypeFile');
                //$originalFileName = $image->getClientOriginalName();
                $extension = $image->getClientOriginalExtension();

                $docs_name  = $user_id.'__'.$tax_type.'.'.$extension; 
                $path_docs  = $docs_storage_path.$docs_name;
                $path_pdf   = $pdf_storage_path.$user_id.'__'.$tax_type.".pdf";    

                $img = Image::make($image->getRealPath());
                $height = $img->height();
                $width  = $img->width();
                if($width>600 || $height>600) {
                    if ($width>$height) {
                        $img->resize(600, null, function ($constraint) {
                            $constraint->aspectRatio();
                        });
                    } else if ($width<$height) {
                        $img->resize(null, 600, function ($constraint) {
                            $constraint->aspectRatio();
                        });
                    } else {
                        $img->resize(600, 600);    
                    }
                    $img->save(storage_path().'/app/uploads/docs/'.$docs_name);
                } else {
                    $request->idTypeFile->storeAs('uploads/docs', $docs_name);
                }

0 个答案:

没有答案