From 6644c6936655a6bb71e4e792174a81499177df08 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 19 Jul 2019 23:07:33 -0600 Subject: [PATCH] Update AvatarController --- app/Http/Controllers/AvatarController.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/AvatarController.php b/app/Http/Controllers/AvatarController.php index ef63afa1..3a464ce1 100644 --- a/app/Http/Controllers/AvatarController.php +++ b/app/Http/Controllers/AvatarController.php @@ -73,7 +73,7 @@ class AvatarController extends Controller public function buildPath($id) { - $padded = str_pad($id, 12, 0, STR_PAD_LEFT); + $padded = str_pad($id, 19, 0, STR_PAD_LEFT); $parts = str_split($padded, 3); foreach ($parts as $k => $part) { if ($k == 0) { @@ -93,6 +93,21 @@ class AvatarController extends Controller $prefix = storage_path('app/'.$avatarpath); $this->checkDir($prefix); } + if ($k == 4) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } + if ($k == 5) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4].'/'.$parts[5]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } + if ($k == 6) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4].'/'.$parts[5].'/'.$parts[6]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } } return $avatarpath;