1
0
Fork 0
forked from mirror/pixelfed

Update AvatarController

This commit is contained in:
Daniel Supernault 2019-07-19 23:07:33 -06:00
parent 3603913f2a
commit 6644c69366
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -73,7 +73,7 @@ class AvatarController extends Controller
public function buildPath($id) 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); $parts = str_split($padded, 3);
foreach ($parts as $k => $part) { foreach ($parts as $k => $part) {
if ($k == 0) { if ($k == 0) {
@ -93,6 +93,21 @@ class AvatarController extends Controller
$prefix = storage_path('app/'.$avatarpath); $prefix = storage_path('app/'.$avatarpath);
$this->checkDir($prefix); $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; return $avatarpath;