2021-09-17 06:42:56 +00:00
|
|
|
{% macro book_cover_image(book, thumbnails, title=None) -%}
|
2021-03-20 10:32:50 +00:00
|
|
|
{%- set book_title = book.title if book.title else book.name -%}
|
2021-09-17 04:20:11 +00:00
|
|
|
{%- set book_title = title if title else book_title -%}
|
2021-03-20 10:32:50 +00:00
|
|
|
{% set srcset = thumbnails|get_book_thumbnail_srcset if thumbnails|length else '' %}
|
|
|
|
{%- if srcset|length -%}
|
|
|
|
<img
|
|
|
|
srcset="{{ srcset }}"
|
|
|
|
src="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id) }}"
|
|
|
|
alt="{{ book_title }}"
|
|
|
|
/>
|
|
|
|
{%- else -%}
|
|
|
|
<img src="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id) }}" alt="{{ book_title }}" />
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endmacro %}
|