X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a4f5747875aa0fb598e69d2200ef431c2fb7f1e9..c30b0cf1f501570e220f8dd2578f41eaf1585050:/src/cover/views.py 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: