diff options
-rw-r--r-- | lib/private/avatar.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/avatar.php b/lib/private/avatar.php index baaccaa86e6..90a8b8c26f9 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -67,8 +67,13 @@ class Avatar implements \OCP\IAvatar { } $avatar = new OC_Image(); - $avatar->loadFromData($this->view->file_get_contents('avatar.'.$ext)); - $avatar->resize($size); + if ($this->view->file_exists('avatar.' . $size . '.' . $ext)) { + $avatar->loadFromData($this->view->file_get_contents('avatar.' . $size . '.' . $ext)); + } else { + $avatar->loadFromData($this->view->file_get_contents('avatar.' . $ext)); + $avatar->resize($size); + $this->view->file_put_contents('avatar.' . $size . '.' . $ext, $avatar->data()); + } return $avatar; } |