def add_arguments(self, parser):
parser.add_argument('slug')
parser.add_argument('size', type=int)
+ parser.add_argument('--bleed', action='store_true')
def handle(self, *args, **options):
slug = options['slug']
size = options['size']
+ bleed = 20 if options['bleed'] else 0
wldoc = Book.objects.get(slug=slug).wldocument()
- cover = DefaultEbookCover(wldoc.book_info, width=size)
+ cover = DefaultEbookCover(wldoc.book_info, width=size, bleed=bleed)
cover.save('%s.jpg' % slug)
url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
'book_fragments', name='book_fragments'),
+ url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, 'ridero_cover'),
+
# Includes.
url(r'^b/(?P<pk>\d+)/mini\.(?P<lang>.+)\.html', 'book_mini', name='catalogue_book_mini'),
url(r'^b/(?P<pk>\d+)/mini_nolink\.(?P<lang>.+)\.html', 'book_mini', {'with_link': False},
'objects': objects,
'best': best,
})
+
+
+def ridero_cover(request, slug):
+ from librarian.cover import DefaultEbookCover
+ wldoc = Book.objects.get(slug=slug).wldocument()
+ cover = DefaultEbookCover(wldoc.book_info, width=980, bleed=20, format='PNG')
+ response = HttpResponse(content_type="image/png")
+ cover.save(response)
+ return response