From: Radek Czajka Date: Tue, 7 Jun 2022 10:54:01 +0000 (+0200) Subject: new covers X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/c30b0cf1f501570e220f8dd2578f41eaf1585050 new covers --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 0861384d..a7a944ef 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -10,7 +10,7 @@ python-slugify python-docx==0.8.10 Wikidata==0.6.1 -librarian==2.4.2 +librarian==2.4.3 ## Django Django==3.2.12 diff --git a/src/cover/views.py b/src/cover/views.py index 620ad1aa..660909d5 100644 --- a/src/cover/views.py +++ b/src/cover/views.py @@ -50,14 +50,15 @@ def preview(request, book, chunk=None, rev=None): width = int(width) if width else None height=request.GET.get('height') height = int(height) if height else None - cover = make_cover(info, width=width, height=height) - #cover = make_cover(info) + + if not (height or width): + width, height = PREVIEW_SIZE + + cover_class = request.GET.get('cover_class', 'default') + + cover = make_cover(info, cover_class=cover_class, width=width, height=height) response = HttpResponse(content_type=cover.mime_type()) - if height or width: - size = (width, height) - else: - size = PREVIEW_SIZE - img = cover.image().resize(size, Image.ANTIALIAS) + img = cover.final_image() img.save(response, cover.format) if 'download' in request.GET: diff --git a/src/documents/templates/documents/book_detail.html b/src/documents/templates/documents/book_detail.html index 1c06f97c..77377542 100644 --- a/src/documents/templates/documents/book_detail.html +++ b/src/documents/templates/documents/book_detail.html @@ -72,29 +72,38 @@
-
- -{% if book.dc_cover_image %} - {{ book.dc_cover_image }} -{% endif %} -

- -
- {% csrf_token %} - - -
- - -

-
- -Okładka w rozmiarze - x - -
-
-
+
+ + {% if book.dc_cover_image %} + {{ book.dc_cover_image }} + {% endif %} +

+ +
+ {% csrf_token %} +
+ + +
+
+ + +

+
+ + Pobierz okładkę: +
+
+ + + +
+
+
+

{% trans "Last published" %}: {% if book.last_published %} {{ book.last_published }}