Как изменить размер аватарки xenforo

What is the recommended way to change avatar size for the default XF 2.0 theme? I'd like them to be 150px wide and have a dynamic height if possible. Thanks for the help.

  • #2

You can’t change avatar physical size without writing an add-on, there’s no such an option as avatar size. You can change the representational size by adjusting setup.less:

Code:

// AVATARS
@_avatarBaseSize: 96px;
@avatar-xxs: (@_avatarBaseSize) / 4;
@avatar-xs:  (@_avatarBaseSize) / 3;
@avatar-s:   (@_avatarBaseSize) / 2;
@avatar-m:   (@_avatarBaseSize);
@avatar-l:   (@_avatarBaseSize) * 2;
@avatar-o:   (@_avatarBaseSize) * 4;

Please not that any change to that can cause blurry avatars.

  • #3

Wow that seems like an obvious feature to overlook. Thanks for the info @CyberAP

The avatars are already being resized with what seems to be a very low jpg quality setting, so scaling up the display size will make them look very bad.

Is there a way to adjust quality settings for resized avatars? I tried uploading all kinds of images in various qualities, all of them get saved to mushy looking jpg’s with visible artifacts.

  • #4

The solution would be identical to that in XF1. You edit all the templates that have <xf:avatar /> and increase the size to 1 step. Then you downscale them with CSS.

Basic example in message_macros:

Change

HTML:

<xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />

To this

HTML:

<xf:avatar user="$user" size="l" defaultname="{$fallbackName}" itemprop="image" />

Then use CSS and downscale that avatar to the desired dimensions. Repeat this step for any avatar occurrences.

  • #5

Thanks again @CyberAP

Are you saying that by default, XF is creating a small image for avatars and then scaling it up for display at the default size in the default style? Is that why the avatars look so bad, and not due to a jpg quality/compression setting?

  • #6

Have a look into your data/avatars folder. Upon uploading, XenForo will create 5 versions of each avatar, scaled to the respective size. This will improve page load time especially for large avatars and mobile devices, but when you then try to enlarge a 48×48 (S Size) avatar, you’ll obviously get blurry results.

  • #7

Have a look into your data/avatars folder. Upon uploading, XenForo will create 5 versions of each avatar, scaled to the respective size. This will improve page load time especially for large avatars and mobile devices, but when you then try to enlarge a 48×48 (S Size) avatar, you’ll obviously get blurry results.

Thanks for the info.

It appears that my default theme is serving avatars from data/avatars/m/ directory. These are 96×96 which is the same as the display size. Meaning they are not being scaled up with CSS. The quality is just poor, so back to my previous question.

Is there a way to change the jpg quality/compression settings used when these images are created?

  • #8

I haven’t seen anything in the ACP for that, so probably only with an add-on.

  • #9

It really should be an integral part of the forum software and included settings, but it’s not. 96px is not very large and needs to be increased. I hope XF team reads this thread and make an effort to give us the ability to adjust the size in the near future.

  • #10

It really should be an integral part of the forum software and included settings, but it’s not. 96px is not very large and needs to be increased. I hope XF team reads this thread and make an effort to give us the ability to adjust the size in the near future.

The actual size limit is 384px.

  • #11

Then use CSS and downscale that avatar to the desired dimensions. Repeat this step for any avatar occurrences.

What exactly would the CSS downscale look like if you don’t mind me asking?

  • #12

What exactly would the CSS downscale look like if you don’t mind me asking?

You explicitly set width and height of an element. If your image is displayed as a background image it’s best to also set background-size: cover;

  • #13

I have tried everything I can think off trying to get dynamic height for the message avatar using css.
I am using a 300×600 image avatar, I upped the size in message macros, and this is what I am using for css:

Code:

.message-cell .avatar--l
{
    width: 96px;
    height: auto;
}

Any Help is very much appreciated.

Last edited: Dec 24, 2017

  • #14

This would work only with modern browsers (no IE):

CSS:

body .avatar.size--ANY
{
    width: ANY;
    height: ANY;
}

body .avatar img:not(.cropImage)
{
    object-fit: contain; /* or object-fit: cover; if you want avatars to cover the box completely */
}

Replace ANY with your selectors and dimensions. Don’t use auto there. Also, don’t forget to change the actual size property in xf:avatar.

  • #15

This would work only with modern browsers (no IE):

CSS:

body .avatar.size--ANY
{
    width: ANY;
    height: ANY;
}

body .avatar img:not(.cropImage)
{
    object-fit: contain; /* or object-fit: cover; if you want avatars to cover the box completely */
}

Replace ANY with your selectors and dimensions. Don’t use auto there. Also, don’t forget to change the actual size property in xf:avatar.

Will that code fix the issue with the images being blurry?

  • #16

No. You’ll need to load a higher resolution image before scaling it with CSS. The blurriness comes from upscaling and no CSS code will be able to solve that.

  • #17

I found a great solution here,

xenforo.com

XF 2.0 — How to enlarge avatars in topic view without blurriness?

I’m simply trying to enlarge the avatars just a bit in message view, but when I go into setup.less and make the medium size a little bigger (as seen here: https://xenforo.com/community/threads/avatar-size.135801/ ), it does work, but every avatar gets just a little bit blurry. Looks like it’s…

xenforo.com


xenforo.com

Start at post #5 in the thread and read down from there.

Дополнение даёт возможность менять размеры аватаров на всем сайте.

Главные функции:

  • выбор изображений, размеры которого будут изменены;
  • можно указать максимальную ширину и высоту аватаров;
  • автонастройка новых аватаров под ваши параметры;
  • модифицирует шаблоны, чтобы показывать данные о пользователе в статистике и другие.

XF2 категории:

hidest_menu

Другое

social_media

Sysnative: Improved Membe…

Показывает недавно зарегистрированных и онлай…

addon-odd

[OzzModz] Style Chooser I…

Выбор стиля в навигационной панели.

social_media

[Liam W.] Custom Editor C…

Добавляет новые цвета и отключает стандартные…

addon-odd

[XTR] Style Switcher

Изменение внешнего вида веб-страницы.

social_media

[CZ] Avatar Sizer

Позволяет изменить размер аватарок на всем са…

Статистика

services
Всего ресурсов:


1261

  • #2

они сами меняются когда сервер заполняется не?

  • #3

они сами меняются когда сервер заполняется не?

Нет, раньше сразу всё было

kylc

kylc

Не мир плох, плохи люди, обвиняющие во всем мир


  • #4

Попробуйте режим игры поменять. Может в нем дело

  • #5

Попробуйте режим игры поменять. Может в нем дело

У меня обычный стоит, всё норм

  • #6

Напиши в тех.поддержку своего хостинга, но вообще, мелкие значки появляются только тогда, когда много людей на сервере(11+ игроков), по-другому не знаю =)

  • #7

Напиши в тех.поддержку своего хостинга, но вообще, мелкие значки появляются только тогда, когда много людей на сервере(11+ игроков), по-другому не знаю =)

Я когда играю на официальных серверах в режим «Обычный», то там маленькие значки.

  • #8

sv_competitive_official_5v5 0 в server.cfg

  • #9

sv_competitive_official_5v5 0 в server.cfg

Ничего не изменилось. Может нужно просто другое значение поставить?

  • #10

Ничего не изменилось. Может нужно просто другое значение поставить?

Попробуй в конфиг режима прописать

  • #11

Ничего не изменилось. Может нужно просто другое значение поставить?

этот квар типо вх при после смерти при нажатии на Х (явно не отвечает за аватарки)

kylc

kylc

Не мир плох, плохи люди, обвиняющие во всем мир


  • #12

Попробуй в конфиг режима прописать

В обычном режиме изначально стоит значение 0.

  • #13

этот квар типо вх при после смерти при нажатии на Х (явно не отвечает за аватарки)

Этот квар так же отвечает и за табло, про которое писал автор

  • #14

Попробуй в конфиг режима прописать

После сбоя всё что я писал в cfg режима не читалось, поэтому я всё перенёс в server.cfg

  • #15

Насколько я понял — сервер не читал cfg режима, не понимал, что я хочу поставить обычный. Поковырялся в gamemodes_server.cfg — что-то получилось, но потом опять всё сломал. Переустановил сервер, теперь всё норм.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Как изменить размер zip папки
  • Как изменить размер webp
  • Как изменить размер vmdk
  • Как изменить размер vhd файла
  • Как изменить размер vdi virtualbox

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии