1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00

Update AvatarController

This commit is contained in:
Daniel Supernault 2019-03-01 14:02:05 -07:00
parent fca4562933
commit a2641dfc78
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -30,11 +30,10 @@ class AvatarController extends Controller
$dir = $path['root'];
$name = $path['name'];
$public = $path['storage'];
$currentAvatar = storage_path('app/'.$profile->avatar->media_path);
$loc = $request->file('avatar')->storeAs($public, $name);
$avatar = Avatar::firstOrNew(['profile_id' => $profile->id]);
$opath = $avatar->media_path;
$currentAvatar = $avatar->recentlyCreated ? null : storage_path('app/'.$profile->avatar->media_path);
$avatar->media_path = "$public/$name";
$avatar->thumb_path = null;
$avatar->change_count = ++$avatar->change_count;