forked from mirror/pixelfed
Update AvatarController
This commit is contained in:
parent
3603913f2a
commit
6644c69366
1 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue