diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-08-01 22:54:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 22:54:38 +0200 |
commit | fae7e516b5e17ae95e850a866c9e5a08732e2f6b (patch) | |
tree | 3234679e25c38ef05f9a88d8368fe03287b4066c /lib | |
parent | b5c5faebfc136d634fd7e80d6a0a8e1094bca717 (diff) | |
parent | 38fffffe18dc705f29bbb477aebd8497f173d37a (diff) | |
download | nextcloud-server-fae7e516b5e17ae95e850a866c9e5a08732e2f6b.tar.gz nextcloud-server-fae7e516b5e17ae95e850a866c9e5a08732e2f6b.zip |
Merge pull request #10481 from nextcloud/feature/noid/make-info-available-if-the-avatar-was-uploaded
Make the info available if the avatar was uploaded or generated
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Avatar.php | 11 | ||||
-rw-r--r-- | lib/public/IAvatar.php | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php index 9dbeb4ac745..116f8368e71 100644 --- a/lib/private/Avatar.php +++ b/lib/private/Avatar.php @@ -120,6 +120,15 @@ class Avatar implements IAvatar { } /** + * Check if the avatar of a user is a custom uploaded one + * + * @return bool + */ + public function isCustomAvatar(): bool { + return !$this->folder->fileExists('generated'); + } + + /** * sets the users avatar * @param IImage|resource|string $data An image object, imagedata or path to set a new avatar * @throws \Exception if the provided file is not a jpg or png image @@ -362,7 +371,7 @@ class Avatar implements IAvatar { * @param string $font font path * @param int $size font size * @param int $angle - * @return Array + * @return array */ protected function imageTTFCenter($image, string $text, string $font, int $size, $angle = 0): array { // Image width & height diff --git a/lib/public/IAvatar.php b/lib/public/IAvatar.php index 85863357069..448d5dfc02f 100644 --- a/lib/public/IAvatar.php +++ b/lib/public/IAvatar.php @@ -54,6 +54,14 @@ interface IAvatar { public function exists(); /** + * Check if the avatar of a user is a custom uploaded one + * + * @return bool + * @since 14.0.0 + */ + public function isCustomAvatar(): bool; + + /** * sets the users avatar * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar * @throws \Exception if the provided file is not a jpg or png image |