templates/PageParts/GalleryPagePart/view.html.twig line 1

Open in your IDE?
  1. <section class="content">
  2.     {% if (resource.images | length > 1) %}
  3.         <div class="gallery" id="gallery-{{ resource.id }}">
  4.             <div class="gallery-boxes">
  5.                 {% for image in resource.images %}
  6.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  7.                         <div class="gallery-box">
  8.                             {% set img = image ? image : null %}
  9.                             {% if img is not null and img is not empty %}
  10.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1400, q: 80 }) %}
  11.                                 {% set fullSrcUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1920, q: 80 }) %}
  12.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  13.                                 <a href="{{ asset(fullSrcUrl) }}"
  14.                                    data-gallery-id="{{ resource.id }}" data-gallery-slide="{{ img.id }}">
  15.                                     <img class="lazy" src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  16.                                          {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  17.                                 </a>
  18.                             {% endif %}
  19.                         </div>
  20.                     {% endif %}
  21.                 {% endfor %}
  22.             </div>
  23.             <div class="gallery-nav">
  24.                 {% for image in resource.images %}
  25.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  26.                         <div class="gallery-thumb">
  27.                             {% set img = image ? image : null %}
  28.                             {% if img is not null and img is not empty %}
  29.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 180, q: 80, fit: 'crop' }) %}
  30.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  31.                                 <img class="lazy"
  32.                                      src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  33.                                      {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  34.                             {% endif %}
  35.                         </div>
  36.                     {% endif %}
  37.                 {% endfor %}
  38.             </div>
  39.             <div class="gallery-clearfix"></div>
  40.         </div>
  41.         <div class="gallery fullscreen" id="gallery-fullscreen-{{ resource.id }}">
  42.             <div class="gallery-boxes">
  43.                 {% for image in resource.images %}
  44.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  45.                         <div class="gallery-box">
  46.                             {% set img = image ? image : null %}
  47.                             {% if img is not null and img is not empty %}
  48.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1920, q: 80 }) %}
  49.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  50.                                 <a href="{{ asset(imgUrl) }}"
  51.                                    data-gallery-id="{{ resource.id }}" data-gallery-slide="{{ img.id }}">
  52.                                     <img class="lazy" src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  53.                                          {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  54.                                 </a>
  55.                             {% endif %}
  56.                         </div>
  57.                     {% endif %}
  58.                 {% endfor %}
  59.             </div>
  60.             <div class="gallery-nav">
  61.                 {% for image in resource.images %}
  62.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  63.                         <div class="gallery-thumb">
  64.                             {% set img = image ? image : null %}
  65.                             {% if img is not null and img is not empty %}
  66.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 180, q: 80, fit: 'crop' }) %}
  67.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  68.                                 <img class="lazy" src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  69.                                      {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  70.                             {% endif %}
  71.                         </div>
  72.                     {% endif %}
  73.                 {% endfor %}
  74.             </div>
  75.             <div class="gallery-clearfix"></div>
  76.             <div class="gallery-close"><i class="fas fa-times"></i></div>
  77.             <div class="gallery-caption">
  78.             </div>
  79.         </div>
  80.     {% else %}
  81.         <div class="gallery" id="gallery-{{ resource.id }}">
  82.             <div class="gallery-boxes">
  83.                 {% for image in resource.images %}
  84.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  85.                         <div class="gallery-box">
  86.                             {% set img = image ? image : null %}
  87.                             {% set cropSettings = "?fit=max&w=1400" %}
  88.                             {% if img is not null and img is not empty %}
  89.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1400, q: 80, fit: 'max' }) %}
  90.                                 {% set fullSrcUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1920, q: 80 }) %}
  91.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  92.                                 <a href="{{ asset(fullSrcUrl) }}"
  93.                                    data-gallery-id="{{ resource.id }}" data-gallery-slide="{{ img.id }}">
  94.                                     <img class="lazy" src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  95.                                          {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  96.                                 </a>
  97.                             {% endif %}
  98.                         </div>
  99.                     {% endif %}
  100.                 {% endfor %}
  101.             </div>
  102.         </div>
  103.         <div class="gallery fullscreen" id="gallery-fullscreen-{{ resource.id }}">
  104.             <div class="gallery-boxes">
  105.                 {% for image in resource.images %}
  106.                     {% if ( image.media and image.media.contentType != "application/octet-stream") %}
  107.                         <div class="gallery-box">
  108.                             {% set img = image ? image : null %}
  109.                             {% if img is not null and img is not empty %}
  110.                                 {% set imgUrl = croppedImgSrc(img.media.url, img.cropping, { w: 1920, q: 80, fit: 'max' }) %}
  111.                                 {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, { w: 75, h: 60, q: 50, blur: 20, fit: 'crop' }) %}
  112.                                 <a href="{{ asset(imgUrl) }}"
  113.                                    data-gallery-id="{{ resource.id }}" data-gallery-slide="{{ img.id }}">
  114.                                     <img class="lazy" src="{{ previewSrc }}" data-src="{{ imgUrl }}"
  115.                                          {% if img.altText %}alt="{{ img.altText }}"{% endif %} />
  116.                                 </a>
  117.                             {% endif %}
  118.                         </div>
  119.                     {% endif %}
  120.                 {% endfor %}
  121.             </div>
  122.             <div class="gallery-clearfix"></div>
  123.             <div class="gallery-close"><i class="fas fa-times"></i></div>
  124.             <div class="gallery-caption">
  125.             </div>
  126.         </div>
  127.     {% endif %}
  128. </section>