1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Animated Avatars in threads

Discussion in 'Template Modifications [Archive]' started by Junior, Apr 10, 2011.

  1. Junior

    Junior Well-Known Member

    This is a simple template edit that allows animated avatars to show in posts. You have two options here:

    1. Forces the size of all avatars to be 96x96
    2. Allow avatars to use their aspect ration.

    Also there is 2 versions, one that displays the animation to everyone and the other codes won't show animation to guests for faster browsing. :)

    Guest will see animation


    Forced 96x96 edit: Open template message_user_info

    Find
    Code:
    <xen:avatar user="$user" size="m" />
    Replace with
    Code:
    <a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
    <img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" height="96px" width="96px" itemprop="photo" />
    </a>
    Aspect ration edit: Open template message_user_info

    Find
    Code:
    <xen:avatar user="$user" size="m" />
    Replace with
    Code:
    <a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
    <img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" style="max-height:96px;max-width:96px;" itemprop="photo" />
    </a>
    If guest; do not display animation

    Forced 96x96 edit: Open template message_user_info

    Find
    Code:
    <xen:avatar user="$user" size="m" />
    Replace with
    Code:
    <xen:if is="!{$visitor.user_id}">
    <xen:avatar user="$user" size="m" />
    <xen:else />
    <a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
    <img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" height="96px" width="96px" itemprop="photo" />
    </a></xen:if>
    Aspect ration edit: Open template message_user_info

    Find
    Code:
    <xen:avatar user="$user" size="m" />
    Replace with
    Code:
    <xen:if is="!{$visitor.user_id}">
    <xen:avatar user="$user" size="m" />
    <xen:else />
    <a class="username avatar Av{$user.user_id}l" href="{xen:link members, $user}">
    <img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" style="max-height:96px;max-width:96px;" itemprop="photo" />
    </a></xen:if>
    Demo
     
    Dylan V, otto, Komori and 17 others like this.
  2. Veer

    Veer Well-Known Member

    Well done Junior.

    What is the reason to link avatars to {xen:link account/avatar} so there's no member card, I like to view member card instead.
     
    Junior likes this.
  3. Junior

    Junior Well-Known Member

    That was a mistake ^ ^ You'll notice the 'edits'. I've corrected this to a point. It now redirects to a members profile but I have not found how the profile card works. Let me look into it a little more and I'll have the edit up.

    Please update to the newer code in the mean time. :)

    Edit: Updated added username to the class in the url. Remove this if you do not want the profile card popping up and you just want a direct link to the profile page.
     
  4. Veer

    Veer Well-Known Member

    okay updated and its fine now.

    Thanks.

    PS. Updated new code, Member card is back now, great.
     
    Junior likes this.
  5. sylwester

    sylwester Member

    any demo?
     
  6. Junior

    Junior Well-Known Member

    I have this modification set up at XFProud, you may test it there.
     
  7. Peggy

    Peggy Well-Known Member

    I don't see any animated avatars over there. :)
     
    Dodgeboard likes this.
  8. sylwester

    sylwester Member

    already done . looks nice .
    thanks
     
    Junior likes this.
  9. Ryan Kent

    Ryan Kent Well-Known Member

  10. Junior

    Junior Well-Known Member

    As of right now it is complete unless you have some ideas for expanding it. I'm thinking of having it manage guest to see the gif avatars without animation to ensure a faster browing experience. If you want to wait for that, it'll be up tonight.

    Of course the regular code will still be available as well.
     
  11. Peggy

    Peggy Well-Known Member

    Junior likes this.
  12. Dodgeboard

    Dodgeboard Well-Known Member

    Avatar is small for the membercard.

    So will the avatar be stuck at 96x96 when you click on the membercard, or will it be full sized?
     
  13. Junior

    Junior Well-Known Member

    This edit does not effect the membercard.
     
  14. Junior

    Junior Well-Known Member

    Done :) Hopefully the thread doesn't look too confusing now. :LOL:
     
  15. Ryan Kent

    Ryan Kent Well-Known Member

    It seems to affect it on your site. The normal member card avatar takes up the full square block. When I look at Sylwester's member card on your site, the avatar is substantially smaller then it should be. The normal member card avatar is 192 x 192 I believe.

    Click on your avatar on your site and look at your member card, then check Sylwester's avatar and check his member card. His image is much smaller.
     
  16. Junior

    Junior Well-Known Member

    It's just coincidental the avatar is the same size as in posts.
    http://xfproud.com/support/members/sylwester.5/

    You're welcome to test it with a larger animated avatar. Just note xenforo kills animation for any avatar for an image larger than 196x196 (I believe).

    http://online-image-editor.com
    This is a good site for resizing gif images.
     
  17. Ryan Kent

    Ryan Kent Well-Known Member

    Perhaps I am misunderstanding. I thought that XF handles all the image re-sizing automatically.

    I uploaded one avatar to this site. That same avatar appears in various sizes throughout the forums. On your site Sylwester's avatar doesn't resize to fill the member card as it would normally, right?
     
  18. Junior

    Junior Well-Known Member

    The resizing only takes place where and when needed. Such as forum posts. It seems they are being forced to 96x96 and also forced into JPG. It even converts a 96x96 oddly enough. Chat about it here:
    http://xenforo.com/community/threads/gif-avatars-converted-to-jpg-for-posts.14804/

    Member profile cards and user profiles don't seem to be resized or converted into anything so long as they have a width smaller than 192px.

    You can note the creator of this threads avatar:
    http://xenforo.com/community/threads/fake-vbulletin-testimonials.14825/

    It does not fill the member card when clicked. It remains its size.

    Hope that gives you a little more insight! :)
     
  19. CFodder

    CFodder Well-Known Member

    This is so cool Junior, thanks very much for it :). Installed and working perfectly.
     
  20. Edrondol

    Edrondol Well-Known Member

    Well done, young man!
     
    kazirhaat likes this.

Share This Page