Weird user avatar bahaviour (v8.3.1)
Permalink
Hi
My pagetype has a User built in attribute in its composer form so I can choose an author for the page.
I am getting the user and it is correctly showing the first name and last name for that user:
However, with the avatar, things get weird.
I have 3 users who all have avatars and this is the behaviour I get:
Super admin - Avatar displays fine at 80 x 80 pixels.
User 2 - It doesn't get the avatar and shows my generic no-user-avatar.png image
User 3 - It gets the avatar, but shows it at 300 x 300 pixels, not the 80x80 in the output function above!
Any ideas how to fix this please?
Thanks
Dave
My pagetype has a User built in attribute in its composer form so I can choose an author for the page.
I am getting the user and it is correctly showing the first name and last name for that user:
$uID = $c->getCollectionUserID(); if($uID) { $ui = UserInfo::getByID($uID); } if($ui) { $firstName = $ui->getAttribute('first_name'); $lastName = $ui->getAttribute('last_name'); $avatar = $ui->getUserAvatar(); if ($ui->hasAvatar()) { $av = $avatar->output(80, 80, true); } else { $av = '<img src="'. $this->getThemePath() .'/images/no-user-avatar.png" alt="">'; } }
Viewing 15 lines of 17 lines. View entire code block.
However, with the avatar, things get weird.
I have 3 users who all have avatars and this is the behaviour I get:
Super admin - Avatar displays fine at 80 x 80 pixels.
User 2 - It doesn't get the avatar and shows my generic no-user-avatar.png image
User 3 - It gets the avatar, but shows it at 300 x 300 pixels, not the 80x80 in the output function above!
Any ideas how to fix this please?
Thanks
Dave
Concrete\Core\User\Avatar\StandardAvatar
Concrete\Core\User\Avatar\Gravatar
Concrete\Core\User\Avatar\EmptyAvatar
If you look at the output() method of StandardAvatar it doesn't appear to support the additional parameters you're sending it. Gravatar doesn't either, it's an extension of the first, but it returns an 80px value because that size is hard coded in to it.
So my guess is that your avatars are being rendered at the exact sizes.