{% if taxon.imagesByType('thumbnail') is not empty %}
    {% set path = taxon.imagesByType('thumbnail').first.path|imagine_filter(filter|default('sylius_large'), {'thumbnail': {'size': [510, 310] }}) %}
{% elseif taxon.images.first %}
    {% set path = taxon.images.first.path|imagine_filter(filter|default('sylius_large'), {'thumbnail': {'size': [510, 310] }}) %}
{% else %}
    {% set path = '//placehold.it/510x310' %}
{% endif %}

<img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ taxon.name }}" class="img-fluid listing-header-img" />
