Skip to content
Snippets Groups Projects
Commit 6b7e7482 authored by Robin Appelman's avatar Robin Appelman
Browse files

cache resized avatars

parent d305412a
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment