diff --git a/app/Http/Controllers/Api/BaseApiController.php b/app/Http/Controllers/Api/BaseApiController.php index 5d3a757dc..5e02a2880 100644 --- a/app/Http/Controllers/Api/BaseApiController.php +++ b/app/Http/Controllers/Api/BaseApiController.php @@ -183,7 +183,6 @@ class BaseApiController extends Controller $avatar = Avatar::whereProfileId($profile->id)->firstOrFail(); $opath = $avatar->media_path; $avatar->media_path = "$public/$name"; - $avatar->thumb_path = null; $avatar->change_count = ++$avatar->change_count; $avatar->last_processed_at = null; $avatar->save(); diff --git a/app/Http/Controllers/AvatarController.php b/app/Http/Controllers/AvatarController.php index 423adc8a1..672e124f1 100644 --- a/app/Http/Controllers/AvatarController.php +++ b/app/Http/Controllers/AvatarController.php @@ -35,7 +35,6 @@ class AvatarController extends Controller $avatar = Avatar::firstOrNew(['profile_id' => $profile->id]); $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; $avatar->last_processed_at = null; $avatar->save(); @@ -121,10 +120,7 @@ class AvatarController extends Controller $avatar = $profile->avatar; if( $avatar->media_path == 'public/avatars/default.png' || - $avatar->thumb_path == 'public/avatars/default.png' || - $avatar->media_path == 'public/avatars/default.jpg' || - $avatar->thumb_path == 'public/avatars/default.jpg' - + $avatar->media_path == 'public/avatars/default.jpg' ) { return; } @@ -133,12 +129,7 @@ class AvatarController extends Controller @unlink(storage_path('app/' . $avatar->media_path)); } - if(is_file(storage_path('app/' . $avatar->thumb_path))) { - @unlink(storage_path('app/' . $avatar->thumb_path)); - } - $avatar->media_path = 'public/avatars/default.jpg'; - $avatar->thumb_path = 'public/avatars/default.jpg'; $avatar->change_count = $avatar->change_count + 1; $avatar->save(); diff --git a/app/Jobs/AvatarPipeline/AvatarOptimize.php b/app/Jobs/AvatarPipeline/AvatarOptimize.php index 437627175..b88901f8f 100644 --- a/app/Jobs/AvatarPipeline/AvatarOptimize.php +++ b/app/Jobs/AvatarPipeline/AvatarOptimize.php @@ -58,7 +58,6 @@ class AvatarOptimize implements ShouldQueue $img->save($file, $quality); $avatar = Avatar::whereProfileId($this->profile->id)->firstOrFail(); - $avatar->thumb_path = $avatar->media_path; $avatar->change_count = ++$avatar->change_count; $avatar->last_processed_at = Carbon::now(); $avatar->save(); diff --git a/app/Jobs/AvatarPipeline/CreateAvatar.php b/app/Jobs/AvatarPipeline/CreateAvatar.php index 2df6c5184..fd5f94cc7 100644 --- a/app/Jobs/AvatarPipeline/CreateAvatar.php +++ b/app/Jobs/AvatarPipeline/CreateAvatar.php @@ -45,7 +45,6 @@ class CreateAvatar implements ShouldQueue $avatar = new Avatar(); $avatar->profile_id = $profile->id; $avatar->media_path = $path; - $avatar->thumb_path = $path; $avatar->change_count = 0; $avatar->last_processed_at = \Carbon\Carbon::now(); $avatar->save(); diff --git a/app/Observers/AvatarObserver.php b/app/Observers/AvatarObserver.php index 1406ceeb6..187a6ff90 100644 --- a/app/Observers/AvatarObserver.php +++ b/app/Observers/AvatarObserver.php @@ -54,13 +54,6 @@ class AvatarObserver ) { @unlink($path); } - $path = storage_path('app/'.$avatar->thumb_path); - if( is_file($path) && - $avatar->thumb_path != 'public/avatars/default.png' && - $avatar->media_path != 'public/avatars/default.jpg' - ) { - @unlink($path); - } } /**