Replace uses of media.filename by media.url
This commit is contained in:
@@ -60,6 +60,7 @@ class Media:
|
||||
- ``filename``: Filename of the resized image.
|
||||
- ``thumbnail``: Location of the corresponding thumbnail image.
|
||||
- ``big``: If not None, location of the unmodified image.
|
||||
- ``big_url``: If not None, url of the unmodified image.
|
||||
- ``exif``: If not None contains a dict with the most common tags. For more
|
||||
information, see :ref:`simple-exif-data`.
|
||||
- ``raw_exif``: If not ``None``, it contains the raw EXIF tags.
|
||||
@@ -112,14 +113,14 @@ class Media:
|
||||
check_or_create_dir(orig_path)
|
||||
big_path = join(orig_path, self.src_filename)
|
||||
if not isfile(big_path):
|
||||
copy(self.src_path, big_path,
|
||||
symlink=s['orig_link'])
|
||||
copy(self.src_path, big_path, symlink=s['orig_link'])
|
||||
return join(s['orig_dir'], self.src_filename)
|
||||
|
||||
@property
|
||||
def big_url(self):
|
||||
"""URL of the original media."""
|
||||
return url_from_path(self.big)
|
||||
if self.big is not None:
|
||||
return url_from_path(self.big)
|
||||
|
||||
@property
|
||||
def thumbnail(self):
|
||||
|
||||
@@ -51,27 +51,27 @@
|
||||
{% if media.type == "image" %}
|
||||
<div class="{{ column_size_t }} columns thumbnail">
|
||||
{% if 'sigal.plugins.media_page' in settings.plugins %}
|
||||
<a href="{{ media.filename}}.html" class="gallery"
|
||||
<a href="{{ media.url}}.html" class="gallery"
|
||||
title="{{ media.title }}"
|
||||
data-href="{{ media.filename }}" {{ img_description(media) }}>
|
||||
data-href="{{ media.url }}" {{ img_description(media) }}>
|
||||
{% else %}
|
||||
<a href="{{ media.url }}" class="gallery" title="{{ media.title }}"
|
||||
{{ img_description(media) }}>
|
||||
{% endif %}
|
||||
<img src="{{ media.thumbnail }}" alt="{{ media.filename }}"
|
||||
<img src="{{ media.thumbnail }}" alt="{{ media.url }}"
|
||||
title="{{ media.title }}" /></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if media.type == "video" %}
|
||||
{% set mhash = media.filename|replace('.', '')|replace(' ', '') %}
|
||||
{% set mhash = media.url|replace('.', '')|replace(' ', '') %}
|
||||
<div class="{{ column_size_t }} columns thumbnail">
|
||||
{% if 'sigal.plugins.media_page' in settings.plugins %}
|
||||
<a href="{{ media.filename }}.html" data-href="#{{ mhash }}"
|
||||
<a href="{{ media.url }}.html" data-href="#{{ mhash }}"
|
||||
{% else %}
|
||||
<a href="#{{ mhash }}" class="gallery" inline='yes' title="{{ media.filename }}"
|
||||
<a href="#{{ mhash }}" class="gallery" inline='yes' title="{{ media.url }}"
|
||||
{% endif %}
|
||||
{% if media.big %} data-big="{{ media.big_url }}"{% endif %}>
|
||||
<img src="{{ media.thumbnail }}" alt="{{ media.filename }}"
|
||||
<img src="{{ media.thumbnail }}" alt="{{ media.url }}"
|
||||
title="{{ media.title }}" /></a>
|
||||
</div>
|
||||
<!-- This contains the hidden content for the video -->
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
{% if media %}
|
||||
<div class="thumbnail">
|
||||
{% if media.type == "image" %}
|
||||
<img src="{{ media.filename }}" alt="{{ media.title }}" title="{{ media.title }}" />
|
||||
<img src="{{ media.url }}" alt="{{ media.title }}" title="{{ media.title }}" />
|
||||
{% endif %}
|
||||
{% if media.type == "video" %}
|
||||
<video controls>
|
||||
<source src='{{ media.filename }}' type='video/webm' />
|
||||
<source src='{{ media.url }}' type='video/webm' />
|
||||
</video>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
{% if previous_media %}
|
||||
<a href="{{ previous_media.filename }}.html">« previous</a>
|
||||
<a href="{{ previous_media.url }}.html">« previous</a>
|
||||
{% endif %}
|
||||
{% if next_media %}
|
||||
<a href="{{ next_media.filename }}.html">next »</a>
|
||||
<a href="{{ next_media.url }}.html">next »</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<style>
|
||||
body::after{
|
||||
position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
|
||||
content:url({{ album.medias[0].filename }});
|
||||
content:url({{ album.medias[0].url }});
|
||||
}</style>
|
||||
{% endif %}
|
||||
|
||||
@@ -81,18 +81,18 @@
|
||||
var data = [
|
||||
{% for media in album.medias -%}
|
||||
{
|
||||
title: "{{ media.title if media.title else media.filename }}",
|
||||
title: "{{ media.title }}",
|
||||
description: "{{ img_description(media) | e }}",
|
||||
thumb: "{{ media.thumbnail }}",
|
||||
{% if media.big %}
|
||||
big: "{{ media.big_url }}",
|
||||
{% endif %}
|
||||
{% if media.type == "image" %}
|
||||
image: "{{ media.filename }}"
|
||||
image: "{{ media.url }}"
|
||||
{% endif %}
|
||||
{% if media.type == "video" %}
|
||||
image: "{{ theme.url }}/img/empty.png",
|
||||
layer: "<video controls><source src='{{ media.filename }}' type='{{ media.mime }}' /></video>"
|
||||
layer: "<video controls><source src='{{ media.url }}' type='{{ media.mime }}' /></video>"
|
||||
{% endif %}
|
||||
},
|
||||
{% endfor %}
|
||||
|
||||
@@ -71,14 +71,14 @@
|
||||
{% if loop.first %}
|
||||
<figure class="gallery__img--main thumbnail" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<a href="{{ media.url }}" itemprop="contentUrl" data-size="{{media.size.width}}x{{media.size.height}}">
|
||||
<img src="{{ theme.url }}/echo/blank.gif" data-echo="{{ media.filename }}" alt="{{ media.filename }}" itemprop="thumbnail" title="{{ media.exif.datetime }}" />
|
||||
<img src="{{ theme.url }}/echo/blank.gif" data-echo="{{ media.url }}" alt="{{ media.url }}" itemprop="thumbnail" title="{{ media.exif.datetime }}" />
|
||||
</a>
|
||||
<figcaption itemprop="caption description">{{ media.title }} - {{ media.exif.datetime }}</figcaption>
|
||||
</figure>
|
||||
{% else %}
|
||||
<figure class="gallery__img--secondary thumbnail" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<a href="{{ media.url }}" itemprop="contentUrl" data-size="{{media.size.width}}x{{media.size.height}}">
|
||||
<img src="{{ theme.url }}/echo/blank.gif" data-echo="{{ media.thumbnail }}" alt="{{ media.filename }}" itemprop="thumbnail" title="{{ media.exif.datetime }}" />
|
||||
<img src="{{ theme.url }}/echo/blank.gif" data-echo="{{ media.thumbnail }}" alt="{{ media.url }}" itemprop="thumbnail" title="{{ media.exif.datetime }}" />
|
||||
</a>
|
||||
<figcaption itemprop="caption description">{{ media.title }} - {{ media.exif.datetime }}</figcaption>
|
||||
</figure>
|
||||
@@ -86,7 +86,7 @@
|
||||
{% endif %}
|
||||
{% if media.type == "video" %}
|
||||
<figure class="gallery__img--secondary thumbnail" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<a href="{{ media.filename }}" itemprop="contentUrl" data-type="video" data-video='<div class="video"><div class="video__container"><video controls><source src="{{ media.filename }}" type="{{ media.mime }}" /></video></div></div>'>
|
||||
<a href="{{ media.url }}" itemprop="contentUrl" data-type="video" data-video='<div class="video"><div class="video__container"><video controls><source src="{{ media.url }}" type="{{ media.mime }}" /></video></div></div>'>
|
||||
<img src="{{ theme.url }}/echo/blank.gif" data-echo="{{ media.thumbnail }}" alt="{{ media.thumbnail }}" itemprop="thumbnail" title="" />
|
||||
</a>
|
||||
<figcaption itemprop="caption description">{{ media_title }}</figcaption>
|
||||
|
||||
Reference in New Issue
Block a user