1. 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?

Discussion in 'XenForo Questions and Support' started by Luxus, May 30, 2012.

  1. Luxus

    Luxus Well-Known Member

    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?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  3. Luxus

    Luxus Well-Known Member

    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?
     
  4. CyclingTribe

    CyclingTribe Well-Known Member

    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)
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    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:
    [​IMG]
    looks like the same character from your avatar.

    That will scale down nicely.
     
    Peggy likes this.
  6. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  7. Luxus

    Luxus Well-Known Member

    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="$usersize="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?
     
  8. Luxus

    Luxus Well-Known Member

    Yay, thanks to this thread I fixed it.

    You have to replace

    HTML:
    <xen:avatar user="$user" size="m" />
    with

    HTML:
    <img src="{xen:helper avatar, $user, l, 'true'}">
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  10. Chris D

    Chris D XenForo Developer Staff Member

    There's a problem with your "solution".

    If you applied that to my avatar, my avatar would look like this:

    [​IMG]
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    And in case you can't visualise that, then it would result in looking like this:

    Capture.PNG
     
  12. Luxus

    Luxus Well-Known Member

    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 ;)
     
  13. Chris D

    Chris D XenForo Developer Staff Member

    And this doesn't look much better which is what you're ultimately trying to achieve:

    Capture2.PNG
     
  14. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  15. Luxus

    Luxus Well-Known Member

    Aligning issues can be fixed with a simple text-align:center. But lets end this discussion, shall we?
     
  16. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  17. Luxus

    Luxus Well-Known Member

    This fixes the problem:

    Code:
    .avatarHolder img
    {
        max-width: 150px;
        max-height: 150px;
    }
     
  18. Chris D

    Chris D XenForo Developer Staff Member

    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
     
  19. Luxus

    Luxus Well-Known Member

    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 ;)
     
  20. Chris D

    Chris D XenForo Developer Staff Member

    The images won't be scaled. They'll be cropped. Look at my example.
     

Share This Page