Exemplo n.º 1
0
 private function setProfileImage($profile, ProfileUpdateRequest $request)
 {
     $tStamp = time();
     $path = 'assets/images/profile/' . auth()->user()->id . '_large_' . $tStamp . '.jpg';
     $thumb_path = 'assets/images/profile/' . auth()->user()->id . '_thumb_' . $tStamp . '.jpg';
     $image = $request->file('image')->move(public_path('assets/images/profile/'), auth()->user()->id . '_org.jpg');
     $img = \Image::make($image->getRealPath());
     $img->fit(200, 200);
     $img->save($path);
     $img->fit(35, 35);
     $img->save($thumb_path);
     if (\File::exists(public_path() . '/' . $profile->image)) {
         \File::delete(public_path() . '/' . $profile->image);
     }
     if (\File::exists(public_path() . '/' . $profile->thumb_image)) {
         \File::delete(public_path() . '/' . $profile->thumb_image);
     }
     $profile->image = $path;
     $profile->thumb_image = $thumb_path;
     $profile->save();
 }
Exemplo n.º 2
0
 public function update($id, ProfileUpdateRequest $request)
 {
     $user = User::findOrFail($id);
     $file = $request->file('photo');
     $destinationPath = base_path() . '/public/image/user/';
     if ($request->hasFile('photo')) {
         $name = time() . $file->getClientOriginalName();
         $file->move($destinationPath, $name);
         $user->photo = $name;
     }
     $user->username = $request->input('username');
     $user->email = $request->input('email');
     $user->password = bcrypt($request->input('password'));
     $user->name_en = $request->input('name_en');
     $user->name_bn = $request->input('name_bn');
     $user->present_address = $request->input('present_address');
     $user->permanent_address = $request->input('permanent_address');
     $user->updated_by = Auth::user()->id;
     $user->updated_at = time();
     $user->update();
     Session()->flash('flash_message', 'Profile Updated Successfully!');
     return redirect('profile_update');
 }