2016-11-06 04:24:43 +00:00
|
|
|
{% set thumbnails =
|
2016-10-10 03:50:13 +00:00
|
|
|
{
|
|
|
|
"audio": "audio",
|
|
|
|
"txt": "txt",
|
2016-10-30 21:20:46 +00:00
|
|
|
"svg": "svg",
|
2016-10-10 03:50:13 +00:00
|
|
|
"video": "video",
|
2016-11-07 02:00:30 +00:00
|
|
|
|
|
|
|
"7z": "archive",
|
|
|
|
"gz": "archive",
|
|
|
|
"rar": "archive",
|
|
|
|
"tar": "archive",
|
|
|
|
"zip": "archive",
|
2016-10-10 03:50:13 +00:00
|
|
|
}
|
|
|
|
%}
|
2016-11-07 02:00:30 +00:00
|
|
|
{% macro create_photo_card(photo, view="grid") %}
|
|
|
|
|
|
|
|
{% if view == "list" %}
|
|
|
|
<div class="photo_card_list">
|
2016-12-21 00:33:40 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
|
2016-11-07 02:00:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{% else %}
|
|
|
|
<div class="photo_card_grid">
|
|
|
|
<div class="photo_card_grid_thumb">
|
2016-12-21 00:33:40 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}">
|
2016-09-18 08:33:46 +00:00
|
|
|
<img height="150"
|
2016-12-21 00:33:40 +00:00
|
|
|
{% if photo.thumbnail %}
|
|
|
|
src="/thumbnail/{{photo.id}}.jpg"
|
2016-12-14 21:26:42 +00:00
|
|
|
{% else %}
|
|
|
|
{% set choice =
|
2016-12-21 00:33:40 +00:00
|
|
|
thumbnails.get(photo.extension,
|
|
|
|
thumbnails.get(photo.mimetype,
|
2016-12-14 21:26:42 +00:00
|
|
|
'other'))
|
|
|
|
%}
|
|
|
|
src="/static/basic_thumbnails/{{choice}}.png"
|
|
|
|
{% endif %}
|
2016-09-18 08:33:46 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
2016-11-07 02:00:30 +00:00
|
|
|
<div class="photo_card_grid_info">
|
2016-12-21 05:33:14 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}" style="word-break:break-all">{{photo.basename}}</a>
|
2016-11-07 02:00:30 +00:00
|
|
|
<span class="photo_card_grid_file_metadata">
|
2016-12-21 00:33:40 +00:00
|
|
|
{% if photo.width %}
|
|
|
|
{{photo.width}}x{{photo.height}},
|
2016-10-10 03:50:13 +00:00
|
|
|
{% endif %}
|
2016-12-21 00:33:40 +00:00
|
|
|
{% if photo.duration %}
|
|
|
|
{{photo.duration_string()}},
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endif %}
|
2016-12-21 00:33:40 +00:00
|
|
|
{{photo.bytestring()}}
|
2016-10-10 03:50:13 +00:00
|
|
|
</span>
|
2016-11-07 02:00:30 +00:00
|
|
|
<span class="photo_card_grid_tags">
|
2016-12-21 00:33:40 +00:00
|
|
|
{% set tags = photo.tags() %}
|
|
|
|
{% set tag_names = [] %}
|
|
|
|
{% for tag in tags %}
|
|
|
|
{% do tag_names.append(tag.name) %}
|
2016-10-10 03:50:13 +00:00
|
|
|
{% endfor %}
|
2016-12-21 00:33:40 +00:00
|
|
|
{% if tags %}
|
|
|
|
<span title="{{", ".join(tag_names)}}">T</span>
|
2016-10-10 03:50:13 +00:00
|
|
|
{% endif %}
|
2016-09-18 08:33:46 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-07 02:00:30 +00:00
|
|
|
{% endif %}
|
2016-12-14 21:26:42 +00:00
|
|
|
{% endmacro %}
|