Use img tag for post avatars.

This commit is contained in:
flash 2019-09-28 18:56:46 +02:00
parent afa296d293
commit b9f3938b9a
4 changed files with 11 additions and 5 deletions

View file

@ -8,8 +8,7 @@
display: block;
border: 0;
border-radius: 5%;
max-height: 200px;
max-width: 200px;
box-sizing: content-box;
box-shadow: 0 1px 4px #111;
vertical-align: middle;
}

View file

@ -147,6 +147,8 @@
}
&__avatar {
color: inherit;
text-decoration: none;
width: 120px;
height: 120px;

View file

@ -373,6 +373,7 @@
{% endmacro %}
{% macro forum_post_entry(post, user_id, perms) %}
{% from 'macros.twig' import avatar %}
{% set is_deleted = post.post_deleted is not null %}
{% set can_post = perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_POST')) %}
{% set can_edit = perms|perms_check(constant('MSZ_FORUM_PERM_EDIT_ANY_POST')) or (
@ -392,9 +393,8 @@
<div class="forum__post__info__background"></div>
<div class="forum__post__info__content">
{% if post.poster_id is not null %}
<a class="avatar forum__post__avatar"
style="background-image:url('{{ url('user-avatar', {'user': post.poster_id, 'res': 240}) }}');"
href="{{ url('user-profile', {'user': post.poster_id}) }}">
<a class="forum__post__avatar" href="{{ url('user-profile', {'user': post.poster_id}) }}">
{{ avatar(post.poster_id, 120, post.poster_name) }}
</a>
<a class="forum__post__username" href="{{ url('user-profile', {'user': post.poster_id}) }}">{{ post.poster_name }}</a>

View file

@ -86,3 +86,8 @@
{% if has_url %}</a>{% endif %}
</div>
{% endmacro %}
{% macro avatar(user_id, resolution, alt_text) %}
{% set avatar_url = url('user-avatar', {'user': user_id, 'res': resolution * 2}) %}
<img class="avatar" src="{{ avatar_url }}" width="{{ resolution }}" height="{{ resolution }}" alt="{{ alt_text|default(avatar_url) }}">
{% endmacro %}