forked from kittv/web
1
0
Fork 0

Změna logiky pro výběr obrázku nebo placeholderu

content
Emil Miler 4 years ago
parent 43e56c306c
commit 8e0210a91a

@ -171,17 +171,14 @@
{% endmacro %} {% endmacro %}
{% macro profile_picture(profile) %} {% macro profile_picture(profile) %}
{% set_global img_found = 0 %} {% set_global img = "../static/placeholder-avatar.jpg" %}
{% for asset in profile.assets %} {% for asset in profile.assets %}
{% if asset is matching("img.(jpg|png)$") %} {% if asset is matching("img.(jpg|png)$") %}
{% set_global img_found = 1 %} {% set_global img = asset %}
<img src="{{ resize_image(path=asset, width=128, height=128, op="fill") }}" alt="{{ profile.title }}"></a>
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if not img_found == 1 %} <img src="{{ resize_image(path=img, width=128, height=128, op="fill") }}" alt="{{ profile.title }}"></a>
<img src="{{ get_url(path="placeholder-avatar.jpg") }}" alt="{{ profile.title }}"></a>
{% endif %}
{% endmacro %} {% endmacro %}
{% macro profile_info(profile) %} {% macro profile_info(profile) %}
@ -221,17 +218,14 @@
<div class="gallery index"> <div class="gallery index">
{% for gallery in section.pages %} {% for gallery in section.pages %}
<a href="{{ gallery.permalink }}"> <a href="{{ gallery.permalink }}">
{% set_global img_found = 0 %} {% set_global img = "../static/placeholder-avatar.jpg" %}
{% for asset in gallery.assets %} {% for asset in gallery.assets %}
{% if asset is matching("[.](jpg|png)$") %} {% if asset is matching("[.](jpg|png)$") %}
{% set_global img_found = 1 %} {% set_global img = asset %}
<img src="{{ resize_image(path=asset, width=300, height=200, op="fill") }}" alt="">
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if not img_found == 1 %} <img src="{{ resize_image(path=img, width=300, height=200, op="fill") }}" alt="{{ gallery.title }}">
<img src="{{ get_url(path="placeholder-avatar.jpg") }}" alt="{{ gallery.title }}">
{% endif %}
<div class="description"> <div class="description">
{% if gallery.description %} {% if gallery.description %}

Loading…
Cancel
Save