我在看这个视频:https://www.youtube.com/watch?v= jy2SUxx6uHc&t=402s 基本上我正在尝试在用户中添加个人资料照片,但没有用。它显示了这个 Call to undefined method Faker\Provider\Image::make() Call to undefined method Faker\Provider\Image::make()我正在使用图像干预 ( http://image.intervention.io/ ) 和引导程序。请帮我 :)我的代码:配置文件.blade.php@extends('layouts.index')@section('content') <div class="container"> <div class="row"> <div class="col-md-10 col-md-offset-1"> <img src="/uploads/avatars/{{ $user->avatar }}" style="width: 150px; height: 150px; float: left; border-radius: 50%; margin-right: 25px;" alt="Profile picture"><h2>{{ $user->name }}'s Profile</h2> <form enctype="multipart/form-data" action="{{ url('profile') }}" method="POST"> <label>Update Profile Image</label> <input type="file" name="avatar"> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <input type="submit" class="pull-right btn btn-sm btn-primary"> </form> </div> </div></div>@endsectionUserController.php-><?phpnamespace App\Http\Controllers;use Illuminate\Http\Request;use Illuminate\Support\Facades\Auth;use Faker\Provider\Image;class UserController extends Controller{ // public function profile(){ return view('profile', array('user' => Auth::user()) ); } public function update_avatar(Request $request){ if($request->hasFile('avatar')){ $avatar = $request->file('avatar'); $filename = time() . '.' . $avatar->getClientOriginalExtension(); Image::make($avatar)->resize(300,300)->save( public_path('/uploads/avatars/' . $filename) ); $user = Auth::user(); $user->avatar = $filename; $user->save(); } return view('profile', array('user' => Auth::user()) ); }}
目前暂无任何回答
- 0 回答
- 0 关注
- 119 浏览
添加回答
举报
0/150
提交
取消