use https urls for google books cover images

pull/1/head
Ed Summers 2012-04-03 13:55:45 -04:00
parent 7769bbd8b3
commit 1187a346ee
2 changed files with 4 additions and 6 deletions

View File

@ -493,15 +493,13 @@ class Edition(models.Model):
def cover_image_small(self): def cover_image_small(self):
if self.googlebooks_id: if self.googlebooks_id:
server_id = random.randint(0, 9) return "https://encrypted.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % self.googlebooks_id
return "http://bks%i.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % (server_id, self.googlebooks_id)
else: else:
return '' return ''
def cover_image_thumbnail(self): def cover_image_thumbnail(self):
if self.googlebooks_id: if self.googlebooks_id:
server_id = random.randint(0, 9) return "https://encrypted.google.com/books?id=%s&printsec=frontcover&img=1&zoom=1" % self.googlebooks_id
return "http://bks%s.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=1" % (server_id, self.googlebooks_id)
else: else:
return '' return ''

View File

@ -294,7 +294,7 @@ $j(document).ready(function(){
<h4>Editions</h4> <h4>Editions</h4>
{% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %} {% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %}
{% for edition in editions %} {% for edition in editions %}
<div class="editions"><div class="image"><img src="http://bks{% cycle '1' '2' '3' '4' '5' '6' '7' '8' '9' %}.books.google.com/books?id={{ edition.googlebooks_id }}&amp;printsec=frontcover&amp;img=1&amp;zoom=5" title="edition cover" alt="edition cover" /></div> <div class="editions"><div class="image"><img src="{{ edition.cover_image_small }}" title="edition cover" alt="edition cover" /></div>
<div class="metadata" id="edition_{{edition.id}}">Publisher: {{edition.publisher}}<br /> <div class="metadata" id="edition_{{edition.id}}">Publisher: {{edition.publisher}}<br />
Published: {{edition.publication_date}}<br /> Published: {{edition.publication_date}}<br />
{% with edition.isbn_13 as isbn %} {% with edition.isbn_13 as isbn %}
@ -304,7 +304,7 @@ $j(document).ready(function(){
No ISBN available<br /> No ISBN available<br />
{% endif %} {% endif %}
{% endwith %} {% endwith %}
See <a href="http://bks{% cycle '1' '2' '3' '4' '5' '6' '7' '8' '9' %}.books.google.com/books?id={{ edition.googlebooks_id }}">this edition on Google Books</a></div> See <a href="https://encrypted.google.com/books?id={{ edition.googlebooks_id }}">this edition on Google Books</a></div>
</div>{{work.last_campaign_status}} </div>{{work.last_campaign_status}}
{% if edition.ebook_form %}{% ifnotequal status 'ACTIVE' %} {% if edition.ebook_form %}{% ifnotequal status 'ACTIVE' %}
<div class="show_more_edition" >more...</div> <div class="show_more_edition" >more...</div>