return response()->json(['message' => 'изменено'] ,200);
nullable()->default(null)
$image = $request->file('avatar');
$fileName = time() . '.' . $image->getClientOriginalExtension();
$img1 = Image::make($image->getRealPath());
$img1->stream(); // <-- Key point
Storage::disk('local')->put('public/images/avatars/' .auth()->id() . '/' . $fileName.$image->getClientOriginalExtension(), $img1, 'public');
$img2 = Image::make($image->getRealPath());
$img2->resize(64, 64, function ($constraint) {
$constraint->aspectRatio();
});
$img2->stream(); // <-- Key point
Storage::disk('local')->put('public/images/avatars/' .auth()->id() . '/' . $fileName.'_x64'.'.'.$image->getClientOriginalExtension(), $img2, 'public');
$img3 = Image::make($image->getRealPath());
$img3->resize(300, 300, function ($constraint) {
$constraint->aspectRatio();
});
$img3->stream(); // <-- Key point
Storage::disk('local')->put('public/images/avatars/' .auth()->id() . '/' . $fileName.'_x300'.'.'.$image->getClientOriginalExtension(), $img3, 'public');
$user->avatar = $fileName;
$user->save();