如果我对这行代码$this->resizeProfilePhoto($file)
发表评论我没有任何令牌错误,但这有什么问题?
public function updateProfilePhoto(Request $request)
{
$this->validate($request, [
'profilePhoto' => 'required:mimes:jpg,png,bmp'
]);
$user = User::find(Auth::user()->id);
$file = $request->file('profilePhoto');
//$this->resizeProfilePhoto($file);
$newName = md5(time() . $file->getClientOriginalName()) . str_random(15) .'.jpg';
$user->photo_path = $newName;
$file->move(
(User::PHOTO_PATH),
User::userPhoto($user, 'orginal')
);
$user->save();
return 'Done';
}
public function resizeProfilePhoto($file)
{
try
{
$img = Image::make(
$file->getRealPath()
);
$img->fit(200);
return $img->save(public_path('images') .'/'. 'test.jpg');
}
catch(Exeption $e)
{
return false;
}
}