{% if section.image.type == "video" %}
{% set video = Video.get(link, section.image) %}
{% set format = settings.ffmpeg.extension %}
{% set vid = video.reencode((1280, 720)) %}
{% else %}
{% set image = Image.get(link, section.image) %}
{% set caption = section.text %}
{% endif %}
{% if section.background %}
<div style="padding: 1px 0px;background: {{ section.background }};">
  {% endif %}
  <div class="bordered-picture baguette caption">
    {% if video %}
    <img class="responsive-img lazy z-depth-2" data-original="{{ video.thumbnail((None, 2000)) }}" alt="">
    <video class="lazy responsive-video" id="{{ vid }}" onclick="goFullscreen('{{ vid }}');" poster="{{ video.thumbnail((None, 2000)) }}" alt="" autoplay="autoplay" loop="loop" preload="auto" muted>
      <source src="{{ vid }}" type="video/{{ format }}">
    </video>
    {% else %}
    <a href="{{ image.copy() }}" {% if caption %}data-caption="{{ caption }}"{% endif %}
       data-at-450="{{ image.thumbnail((None, 450)) }}"
       data-at-800="{{ image.thumbnail((None, 800)) }}"
       data-at-1366="{{ image.thumbnail((None, 1366)) }}"
       data-at-1920="{{ image.thumbnail((None, 1920)) }}"
       >
       <img class="responsive-img lazy z-depth-2" data-original="{{ image.thumbnail((None, 2000)) }}" alt="">
       {% if caption %}
       <div class="caption__overlay card-panel center">
         <h5 class="black-white">{{ caption }}</h5>
       </div>
       {% endif %}
    </a>
    {% endif %}
  </div>
  {% if section.background %}
</div>
{% endif %}
