diff --git a/core/models.py b/core/models.py index 3408a658..bdeeb5b8 100755 --- a/core/models.py +++ b/core/models.py @@ -16,6 +16,7 @@ from datetime import timedelta, datetime from decimal import Decimal from notification import models as notification from postmonkey import PostMonkey, MailChimpException +from sorl.thumbnail import get_thumbnail from tempfile import SpooledTemporaryFile ''' @@ -1711,16 +1712,20 @@ class Edition(models.Model): return "%s (GLUE %s) %s" % (self.title, self.id, self.publisher) def cover_image_small(self): - if self.cover_image: - return self.cover_image + #80 pixel high image + if self.cover_image: + im = get_thumbnail(self.cover_image, 'x80', crop='noop', quality=95) + return im.url elif self.googlebooks_id: return "https://encrypted.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % self.googlebooks_id else: return '' def cover_image_thumbnail(self): + #128 pixel wide image if self.cover_image: - return self.cover_image + im = get_thumbnail(self.cover_image, '128', crop='noop', quality=95) + return im.url elif self.googlebooks_id: return "https://encrypted.google.com/books?id=%s&printsec=frontcover&img=1&zoom=1" % self.googlebooks_id else: diff --git a/frontend/templates/book_panel.html b/frontend/templates/book_panel.html index f7f59a37..5e0c64d0 100644 --- a/frontend/templates/book_panel.html +++ b/frontend/templates/book_panel.html @@ -204,7 +204,7 @@
- Book cover + Book cover
diff --git a/frontend/templates/home.html b/frontend/templates/home.html index 1125c1fb..4c50aede 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -49,7 +49,7 @@ function put_un_in_cookie2(){ {% if work.googlebooks_id %} Find {{ work.title }} at Google Books {% else %} - {{ work.title }} + {{ work.title }} {% endif %}
diff --git a/frontend/templates/work.html b/frontend/templates/work.html index d753a20f..e18511fb 100644 --- a/frontend/templates/work.html +++ b/frontend/templates/work.html @@ -87,7 +87,7 @@
{% else %}
- {{ work.title }} + {{ work.title }}
{% endif %}
diff --git a/requirements_versioned.pip b/requirements_versioned.pip index 417bbb79..1d0b841b 100644 --- a/requirements_versioned.pip +++ b/requirements_versioned.pip @@ -70,6 +70,7 @@ requests==2.6.0 requests-oauthlib==0.4.2 selenium==2.46.0 six==1.9.0 +sorl-thumbnail==12.3 ssh==1.7.14 stevedore==0.4 stripe==1.9.1 diff --git a/settings/common.py b/settings/common.py index 31895ce6..572d0d16 100644 --- a/settings/common.py +++ b/settings/common.py @@ -146,7 +146,8 @@ INSTALLED_APPS = ( 'notification', 'email_change', 'ckeditor', - 'storages', + 'storages', + 'sorl.thumbnail', # this must appear *after* django.frontend or else it overrides the # registration templates in frontend/templates/registration 'django.contrib.admin',