Skip to content

Commit 5a2fbf6

Browse files
author
Visnu Pitiyanuvath
committed
re-use the screenshot virtual; double-res the image
1 parent 24695af commit 5a2fbf6

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

controllers/dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ module.exports = function(app) {
9999
{ name: team.entry.name
100100
, by: team.name
101101
, slug: team.slug
102-
, screenshot: team.screenshot()
102+
, screenshot: team.screenshot
103103
, url: team.entry.url }
104104
, message: commit.message.trim()
105105
, author: commit.author.username
@@ -125,7 +125,7 @@ module.exports = function(app) {
125125
{ name: team.entry.name
126126
, by: team.name
127127
, slug: team.slug
128-
, screenshot: team.screenshot()
128+
, screenshot: team.screenshot
129129
, url: team.entry.url }
130130
, platform: deploy.platform
131131
, updatedAt: deploy.updatedAt };

migrations/winners.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ blurb = (category, slug, fn) ->
1818
console.log team.name
1919
fn """
2020
<div style='clear:both'></div>
21-
<a href='#{team.entry.url}'><img src='#{team.screenshot()}' style='float:right;margin-left:1ex;margin-top:10px;'></a>
21+
<a href='#{team.entry.url}'><img src='#{team.screenshot}' style='float:right;margin-left:1ex;margin-top:10px;'></a>
2222
<h2 style='margin-bottom:0'>
2323
#{category}:
2424
<a href='#{team.entry.url}'>#{team.entry.name}</a>

models/team.coffee

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ TeamSchema.method 'prettifyURL', ->
199199
@entry.url = (if typeof(r.uri) is 'string' then r.uri else r.uri.href) or @entry.url
200200
@save()
201201

202-
TeamSchema.method 'screenshot', ->
202+
TeamSchema.virtual('screenshot').get ->
203203
return unless url = @entry.url
204-
qs = querystring.stringify url: url, resize: '160x93', 'out-format': 'png'
204+
qs = querystring.stringify url: url, resize: '320x186', 'out-format': 'png'
205205
"http://pinkyurl.com/i?#{qs}"
206206

207207
TeamSchema.method 'updateScreenshot', (callback) ->
208208
return unless @entry.url
209-
r = request.get @screenshot() + '&expire=1', (error, response, body) ->
209+
r = request.get "#{@screenshot}&expire=1", (error, response, body) ->
210210
throw error if error
211211
# no callback
212212

views/people/show.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ h1.name= title(person.name)
3939

4040
.next-vote
4141
.entry-info
42-
a( href=nextVote.team.entry.url, target='entry' ): img.screenshot( src=nextVote.team.screenshot() )
42+
a( href=nextVote.team.entry.url, target='entry' ): img.screenshot( src=nextVote.team.screenshot )
4343
h2: a( href=nextVote.team.entry.url, target='entry' )= nextVote.team.entry.name
4444
h3
4545
| by

views/teams/entries.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ul.teams
1616
li
1717
- url = team.entry.url
1818
a( href=url )
19-
img.screenshot( src='http://pinkyurl.com/i?url=' + encodeURIComponent(url) + '&out-format=png&resize=160x93' )
19+
img.screenshot( src=team.screenshot )
2020
h2: a( href=url )= team.entry.name
2121
h4 by
2222
a( href='/teams/' + team )= team.name

views/teams/entry.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.entry-info
22
- if (url = team.entry.url)
33
a( href=url )
4-
img.screenshot( src='http://pinkyurl.com/i?url=' + encodeURIComponent(url) + '&out-format=png&resize=160x93' )
4+
img.screenshot( src=team.screenshot )
55
h2: a( href=url )= team.entry.name
66
- else
77
img.screenshot( src='/images/blank.png' )

0 commit comments

Comments
 (0)