add cover video
This commit is contained in:
parent
b6ba605d10
commit
d7b852216b
@ -290,6 +290,7 @@ def main():
|
|||||||
"sub_title": gallery_settings.get("sub_title", ""),
|
"sub_title": gallery_settings.get("sub_title", ""),
|
||||||
"date": gallery_settings.get("date", ""),
|
"date": gallery_settings.get("date", ""),
|
||||||
"tags": gallery_settings.get("tags", ""),
|
"tags": gallery_settings.get("tags", ""),
|
||||||
|
"cover_type": gallery_settings.get("cover_type", ""),
|
||||||
"cover": cover_image_path,
|
"cover": cover_image_path,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -330,12 +331,16 @@ def main():
|
|||||||
Image.base_dir = os.getcwd()
|
Image.base_dir = os.getcwd()
|
||||||
Image.target_dir = os.path.join(os.getcwd(), "build")
|
Image.target_dir = os.path.join(os.getcwd(), "build")
|
||||||
|
|
||||||
|
Video.base_dir = os.getcwd()
|
||||||
|
Video.target_dir = os.path.join(os.getcwd(), "build")
|
||||||
|
|
||||||
index_html = open(os.path.join("build", "index.html"), "w")
|
index_html = open(os.path.join("build", "index.html"), "w")
|
||||||
|
|
||||||
index_html.write(index_template.render(
|
index_html.write(index_template.render(
|
||||||
settings=settings,
|
settings=settings,
|
||||||
galleries=front_page_galleries_cover,
|
galleries=front_page_galleries_cover,
|
||||||
Image=Image
|
Image=Image,
|
||||||
|
Video=Video
|
||||||
).encode("Utf-8"))
|
).encode("Utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,9 +23,23 @@
|
|||||||
{% if gallery.tags %}<div class="gallery-tag">IN {% for tag in gallery.tags -%} <span> {{ tag }}</span> {% endfor -%}</div>{% endif %}
|
{% if gallery.tags %}<div class="gallery-tag">IN {% for tag in gallery.tags -%} <span> {{ tag }}</span> {% endfor -%}</div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
{% if gallery.cover_type == "video" %}
|
||||||
|
{% set video = Video(gallery.cover) %}
|
||||||
|
{{ video.copy() }}
|
||||||
|
{% else %}
|
||||||
{% set cover = Image(gallery.cover) %}
|
{% set cover = Image(gallery.cover) %}
|
||||||
{{ cover.copy() }}
|
{{ cover.copy() }}
|
||||||
|
{% endif %}
|
||||||
|
{% if video %}
|
||||||
|
<div class="gallery-cover">
|
||||||
|
<img src="{{ video.generate_thumbnail("900") }}">
|
||||||
|
<video autoplay loop muted class="fillWidth">
|
||||||
|
<source src="{{ video }}" type="video/webm" data-source="{{ video }}" data-format="vp8" data-extension="webm">
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="gallery-cover" style="background-image: url('{{ cover.generate_thumbnail("x900") }}');"></div>
|
<div class="gallery-cover" style="background-image: url('{{ cover.generate_thumbnail("x900") }}');"></div>
|
||||||
|
{% endif %}
|
||||||
</div><!-- comment tricks against space between inline-block
|
</div><!-- comment tricks against space between inline-block
|
||||||
-->{% endfor %}
|
-->{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{% if section.image.type == "video" %}
|
{% if section.image.type == "video" %}
|
||||||
{% set video = Video(section.image) %}
|
{% set video = Video(section.image) %}
|
||||||
|
{{ video.copy() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set image = Image(section.image) %}
|
{% set image = Image(section.image) %}
|
||||||
{% set caption = section.text %}
|
{% set caption = section.text %}
|
||||||
@ -10,7 +11,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if video %}
|
{% if video %}
|
||||||
<section class="bordered-picture baguette" style="position: relative;">
|
<section class="bordered-picture baguette" style="position: relative;">
|
||||||
<img class="lazy" data-original="{{ video.generate_thumbnail("2000") }}" src="{{ video.generate_thumbnail("2000") }}" alt="">
|
<img class="lazy" data-original="{{ video.generate_thumbnail("2000") }}" src="" alt="">
|
||||||
<video class="lazy" id="video" poster="{{ video.generate_thumbnail("2000") }}" alt="" autoplay="autoplay" loop="loop" preload="auto" muted>
|
<video class="lazy" id="video" poster="{{ video.generate_thumbnail("2000") }}" alt="" autoplay="autoplay" loop="loop" preload="auto" muted>
|
||||||
<source src="{{ video }}" type="video/webm" data-source="{{ video }}" data-format="vp8" data-extension="webm">
|
<source src="{{ video }}" type="video/webm" data-source="{{ video }}" data-format="vp8" data-extension="webm">
|
||||||
</video>
|
</video>
|
||||||
@ -18,7 +19,7 @@
|
|||||||
<section class="bordered-picture baguette">
|
<section class="bordered-picture baguette">
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
<a href="{{ image }} {% if caption %}data-caption="{{ caption }}"{% endif %}">
|
<a href="{{ image }} {% if caption %}data-caption="{{ caption }}"{% endif %}">
|
||||||
<img class="lazy" src="{{ image }}" data-original="{{ image }}" alt="">
|
<img class="lazy" src="" data-original="{{ image }}" alt="">
|
||||||
{% if caption %}
|
{% if caption %}
|
||||||
<div class="caption__overlay">
|
<div class="caption__overlay">
|
||||||
<h5 class="caption__overlay__title">{{ caption }}</h5>
|
<h5 class="caption__overlay__title">{{ caption }}</h5>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{% if section.image.type == "video" %}
|
{% if section.image.type == "video" %}
|
||||||
{% set video = Video(section.image) %}
|
{% set video = Video(section.image) %}
|
||||||
|
{{ video.copy() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set image = Image(section.image) %}
|
{% set image = Image(section.image) %}
|
||||||
{{ image.copy() }}
|
{{ image.copy() }}
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="picture caption">
|
<div class="picture caption">
|
||||||
{% if video %}
|
{% if video %}
|
||||||
<img class="lazy" data-original="{{ video.generate_thumbnail("600") }}" src="{{ video.generate_thumbnail("600") }}"alt="">
|
<img class="lazy" data-original="{{ video.generate_thumbnail("600") }}" src="" alt="">
|
||||||
<video class="lazy" id="video" poster="{{ video.generate_thumbnail("600") }}" alt="" autoplay="autoplay" loop="loop" preload="auto" muted>
|
<video class="lazy" id="video" poster="{{ video.generate_thumbnail("600") }}" alt="" autoplay="autoplay" loop="loop" preload="auto" muted>
|
||||||
<source src="{{ video }}" type="video/webm" data-source="{{ video }}" data-format="vp8" data-extension="webm">
|
<source src="{{ video }}" type="video/webm" data-source="{{ video }}" data-format="vp8" data-extension="webm">
|
||||||
</video>
|
</video>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ image }}" {% if caption %}data-caption="{{ caption }}"{% endif %}>
|
<a href="{{ image }}" {% if caption %}data-caption="{{ caption }}"{% endif %}>
|
||||||
<img class="lazy" src="{{ image.generate_thumbnail("x600") }}" data-original="{{ image.generate_thumbnail("x600") }}" alt="">
|
<img class="lazy" src="" data-original="{{ image.generate_thumbnail("x600") }}" alt="">
|
||||||
{% if caption %}
|
{% if caption %}
|
||||||
<div class="caption__overlay">
|
<div class="caption__overlay">
|
||||||
<h5 class="caption__overlay__title">{{ caption }}</h5>
|
<h5 class="caption__overlay__title">{{ caption }}</h5>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user