public function getImage($width = null, $height = null)
{
if (!$width) {
$width = 46;
}
if (!$height) {
$height = 46;
}
$id = $this->getId();
$user = PIMCORE_WEBSITE_VAR . "/user-image/user-" . $id . ".png";
if (file_exists($user)) {
$thumb = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/user-thumbnail-" . $id . ".png";
if (!file_exists($thumb)) {
$image = \Pimcore\Image::getInstance();
$image->load($user);
$image->cover($width, $height);
$image->save($thumb, "png");
}
return $thumb;
}
return PIMCORE_PATH . "/static/img/avatar.png";
}