fix avatar path for subdirectory installations (#1201)
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
assets:
|
assets:
|
||||||
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
||||||
|
packages:
|
||||||
|
avatars:
|
||||||
|
base_path: 'avatars'
|
||||||
|
|||||||
@@ -29,6 +29,3 @@ framework:
|
|||||||
#validation:
|
#validation:
|
||||||
# possible values: 'loose', 'strict', 'html5'
|
# possible values: 'loose', 'strict', 'html5'
|
||||||
#email_validation_mode: 'html5'
|
#email_validation_mode: 'html5'
|
||||||
|
|
||||||
assets:
|
|
||||||
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
|
||||||
|
|||||||
@@ -54,6 +54,6 @@ class AvatarExtension extends AbstractExtension
|
|||||||
return $this->packages->getUrl($default);
|
return $this->packages->getUrl($default);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->packages->getUrl($url);
|
return $this->packages->getUrl($url, 'avatars');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ class AvatarService
|
|||||||
|
|
||||||
private function getAvatarUrl(User $profile): string
|
private function getAvatarUrl(User $profile): string
|
||||||
{
|
{
|
||||||
return '/avatars/' . md5($profile->getId() . '_' . $profile->getDisplayName()) . '.png';
|
return md5($profile->getId() . '_' . $profile->getDisplayName()) . '.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getImagePath(User $profile): string
|
private function getImagePath(User $profile): string
|
||||||
{
|
{
|
||||||
$avatarPath = realpath($this->projectDirectory . '/public/');
|
$avatarPath = realpath($this->projectDirectory . '/public/avatars/');
|
||||||
|
|
||||||
return $avatarPath . $this->getAvatarUrl($profile);
|
return $avatarPath . '/' . $this->getAvatarUrl($profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateAvatar(User $profile, bool $regenerate = false): bool
|
public function generateAvatar(User $profile, bool $regenerate = false): bool
|
||||||
|
|||||||
Reference in New Issue
Block a user