Skip to content

Instantly share code, notes, and snippets.

@r38y
Created July 22, 2012 18:58
Show Gist options
  • Select an option

  • Save r38y/3160710 to your computer and use it in GitHub Desktop.

Select an option

Save r38y/3160710 to your computer and use it in GitHub Desktop.
class Dossi.Models.Photo extends Backbone.Model
paramRoot: 'photo'
preload: =>
tempImg = new Image()
tempImg.src = @largeUrl()
tempImg.src = @smallUrl()
largeUrl: ->
@resizeioURL({w: 64, h: 64, t: 'crop'})
smallUrl: ->
@resizeioURL({w: 48, h: 48, t: 'crop'})
resizeioURL: (params={}) ->
uri = new Uri(@get('file_url'))
uri.host(Dossi.resizeioHost)
uri.addQueryParam('w', params['w']) if params['w']
uri.addQueryParam('h', params['h']) if params['h']
uri.addQueryParam('t', params['t']) if params['t']
uri.addQueryParam('m', Dossi.devicePixelRatio)
uri.toString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment