Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Avatars in topic view
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 20, 2015 - 1:18 pm

How can I change the size of the avatars in the topic view? Currently they are 50 x 50, can I change this to be larger, and will the avatars fill up the whole size?  Let's say to 80 x 80?

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Oct 20, 2015 - 2:38 pm

The avatar size is handled by a max-width rule in the forum admin menu, so you can change that in Forum > Profiles > Avatars > Maximum Avatar Display Width (Pixels)..

This will resize the avatar throughout the forum though, not just in topic view. You could make it larger only in topic view with a bit of a CSS change if that interests you? If so, do you have a child theme set up?

Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 20, 2015 - 3:49 pm

Ike said
The avatar size is handled by a max-width rule in the forum admin menu, so you can change that in Forum > Profiles > Avatars > Maximum Avatar Display Width (Pixels)..

This will resize the avatar throughout the forum though, not just in topic view. You could make it larger only in topic view with a bit of a CSS change if that interests you? If so, do you have a child theme set up?

Yes, I have a child theme already in place for sp topic view in reboot.  I want to change the size of the avatars only in topic view.  

Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 20, 2015 - 4:20 pm

I believe I need to edit this in the reboot.php?  I tried it by using using the inspect element and changing the value from 50 to 100, though it won't scale it.  I see one user has an avatar which is 100 x 100, but all others are using the 50x ones.  

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Oct 20, 2015 - 4:30 pm

It won't scale it because the rule set in the admin panel happens inline and will overwrite the CSS.

To get around this, you'll first have to add a new max-width rule then the actual size. Try something like:

#spMainContainer .spTopicPostSection .spPostUserAvatar img {
    max-width: 80px !important;
    width: 80px;
}

The !important will overwrite the inline max-width, then your width underneath can be anything up to and including whatever your new max-width setting is.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 20, 2015 - 4:36 pm

You should really try and do this via the template displkay function - sp_UserAvatar() (see: https://simple-press.com/docum.....seravatar/) which has a 'size' argument that should be changed.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 20, 2015 - 5:51 pm

Ike said
It won't scale it because the rule set in the admin panel happens inline and will overwrite the CSS.

To get around this, you'll first have to add a new max-width rule then the actual size. Try something like:

<br />

#spMainContainer .spTopicPostSection .spPostUserAvatar img {
    max-width: 80px !important;
    width: 80px;
}

<br />

The !important will overwrite the inline max-width, then your width underneath can be anything up to and including whatever your new max-width setting is.

I changed it in reboot.php to this:

#spMainContainer .spTopicPostSection .spPostUserAvatar img { max-width: 50px !important; width: 100px; }

 

But it did not change the setting.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 20, 2015 - 11:55 pm

did you follow Andy's suggestion for the template function?

Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 21, 2015 - 8:27 am

Mr Papa said
did you follow Andy's suggestion for the template function?

Yea, I read it but didn't quite get it, so I didn't want to start messing with stuff that will break the forum.  One thing though, which is the main reason why I didn't do anything else, is that I have the user's avatars show up in the forum view instead of the stock ones provided, so I did not want those to change in size.  I only want the avatar to change in size when viewing the topic.  

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Oct 21, 2015 - 9:09 am

Sorry Alex,

I wasn't aware you could change the size using the template function, Andy is right that's really the correct way to do it. So - Open your spTopicViewDesktop.php from your child theme and locate the function on line 134 -

sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user', $spThisPostUser);

Add the argument 'size=80px' so it will then appear -

sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user&size=80px', $spThisPostUser);

It's worth noting that this only allows you to use 80 x 80px avatars in topic view, it doesn't force it as the argument imposes a max-width rule not a width rule. This means that a user who has a 50 x 50px avatar will not see a change, but a user using an 80 x 80px avatar before will now see it full size as it will no longer be restricted to 50 x 50px.

So if you wanted to force 80 x 80px avatars in topic view, you would still need to add the CSS rule I posted before changing the width of .spPostUserAvatar img to 80px, you just don't need to add the max-width CSS rule to the stylesheet.

And yes this will only affect topic view, everything posted in this topic so far has been topic view specific so you will retain the size constraints elsewhere.

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 618
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10126
Posts: 79622