Zpracování obrázků uživatelů

Profilové obrázky jsou oříznuty generátorem. Skript hledá obrázek ve
složce stránky dle výrazu `img.(jpg|png)$` a pokud žádný obrázek
nenajde, nahradí ho placeholderem ze složky `static`.
remotes/1722757888236843906/tmp_refs/heads/search
Emil Miler 4 years ago
parent ed3f70b695
commit 27fcf6e32e

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

@ -6,6 +6,5 @@ role = "Studijní referent, Garant elektronického zápisu pro KITTV"
email = "eva.battistova@pedf.cuni.cz"
phone = "+420 221 900 141"
time = "Pondělí 12:00 – 13:00"
image = "battistova.jpg"
+++

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

@ -6,6 +6,5 @@ role = "Zahraniční referent"
email = "miroslava.cernochova@pedf.cuni.cz"
phone = "+420 221 900 238"
time = "Středa 12:00 – 13:00"
image = "cernochova.jpg"
+++

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -113,11 +113,7 @@
{% macro list_people() %}
{% for page in section.pages %}
<article>
{% if page.extra.image %}
<img src="{{ page.permalink~page.extra.image }}" alt="{{ page.title }}">
{% else %}
<img src="{{ get_url(path="person.jpg") }}" alt="{{ page.title }}">
{% endif %}
{{ macro::profile_picture(person=page) }}
<div class="info">
<div>
<div class="name"><a href="{{ page.permalink }}">{{ page.title }}</a></div>
@ -140,3 +136,17 @@
</article>
{% endfor %}
{% endmacro %}
{% macro profile_picture(person) %}
{% set_global img_found = 0 %}
{% for asset in person.assets %}
{% if asset is matching("img.(jpg|png)$") %}
{% set_global img_found = 1 %}
<img src="{{ resize_image(path=asset, width=128, height=128, op="fill") }}" alt="{{ person.title }}"></a>
{% break %}
{% endif %}
{% endfor %}
{% if not img_found == 1 %}
<img src="{{ get_url(path="placeholder-avatar.jpg") }}" alt="{{ person.title }}"></a>
{% endif %}
{% endmacro %}

Loading…
Cancel
Save