• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to get rid of fixed avatar sizes?

Luxus

Well-known member
#1
If you upload an avatar the server resizes it to a specific size. I don't like this. Look at my new avatar. Its original size is 48x48 pixels and now it is stretched and looks ugly :( Is there a workaround for this?
 

Jake Bunce

XenForo moderator
Staff member
#2
Short answer... there is no such option.

If you want to change avatars in only one area (such as posts) then it's possible to make an exception.
 

Luxus

Well-known member
#3
How about this:

* The max allowed size of avatars is 150x150 pixels.
* When users try to upload an avatar that exceeds this, the server scales it down automatically.
* All avatars that are not bigger than 150x150 remain in their original size in posts

Is this possible? If so, how?
 

CTXMedia

Formerly CyclingTribe
#4
XenForo does downsize avatars - but at the moment only to the fixed sizes of: large, medium and small.

There isn't an option (at present) to customise the dimensions of these sizes but if you think it would make for a useful feature it might be worth suggesting it. (y)
 

Chris D

XenForo developer
Staff member
#5
* All avatars that are not bigger than 150x150 remain in their original size in posts
That would look terrible.

That would mean your own avatar would be over half the size of everyone elses and would look ugly.

The best solution by far is to upload an avatar of the right size.

Here, I just found this:

looks like the same character from your avatar.

That will scale down nicely.
 

Chris D

XenForo developer
Staff member
#6
In fact, I've just even made a version with the same blue background for you :)

Courage-the-Cowardly-Dog-Ga.png

I feel that one of the best visual features of XenForo is the emphasis on avatars. It makes it feel much more social and I tend to get to know people better by their avatar than I do their names, in some cases. You'll notice avatars play a much bigger part of the overall experience than in other forum software. That's why they need to be a bit bigger.
 

Luxus

Well-known member
#7
That would look terrible.
You know that other forum scripts do that since ages? No, it wouldn't look terrible.

Anyway, I have come up with a possible solution:

The function responsible for displaying avatars in posts is located in the message_user_info template and is as follows:

PHP:
<xen:avatar user="$user" size="m" />
I was thinking about replacing it with something like this:

PHP:
<img src="data/avatars/l/0/User-ID.jpg">
Now I need to know the function that queries the user id. This way, avatars are always displayed in their original sizes in posts. Can anyone help me out with this?
 

Chris D

XenForo developer
Staff member
#9
Anyway, I have come up with a possible solution:
That suggests there's a problem, when there isn't.

You can upload an image of any size. If it's too big it's already scaled down. If it's too smalled it is automatically scaled up. If you can't deal with the loss of quality when it's scaled up then use a higher resolution image.

Redesigning the way the avatar system works is an exercise in futility when the solution is so simple: use a bigger avatar.
 

Luxus

Well-known member
#12
That suggests there's a problem, when there isn't.

You can upload an image of any size. If it's too big it's already scaled down. If it's too smalled it is automatically scaled up. If you can't deal with the loss of quality when it's scaled up then use a higher resolution image.

Redesigning the way the avatar system works is an exercise in futility when the solution is so simple: use a bigger avatar.
When former XenForo customers move to other forum software because of annoying things like how XenForo's avatar system works, then it's cleary a problem. I did my research ;)
 

Chris D

XenForo developer
Staff member
#14
When former XenForo customers move to other forum software because of annoying things like how XenForo's avatar system works, then it's cleary a problem. I did my research ;)
When former XenForo customers move to other forum software because of annoying things like how XenForo's avatar system works then they're shooting themselves in the foot. Because even if that was annoying, which it isn't, then it hardly outweighs the rest of the benefits of the software.
 

Chris D

XenForo developer
Staff member
#16
Aligning issues can be fixed with a simple text-align:center. But lets end this discussion, shall we?
Absolutely. You should do it how you want, but don't forget the problem I highlighted above. The "l" avatar for you is only 48x48, for me it's 192x192. Simple text-align won't solve that problem.
 

Chris D

XenForo developer
Staff member
#18
This fixes the problem:

Code:
.avatarHolder img
{
    max-width: 150px;
    max-height: 150px;
}
No. It doesn't.

That will then crop large images. That will look even worse.

The problem here is not XenForo. The problem is the size of the avatar that someone has chosen to use.

Capture.PNG
 

Luxus

Well-known member
#19
No. It doesn't.

That will then crop large images. That will look even worse.
Actually CSS scaled images look at lot better than images that are encoded by the server, because you will lose quality if the server does the encoding. Anyway, it works for me and everything is looking great now ;)