   if fs.existsSync filename
     return serveFile filename, res
 
-  http.get fullUrl, (response)->
+  http.get fullUrl, (response) ->
     response.pipe(fs.createWriteStream(filename)).on 'close', ->
       serveFile filename, res

fs     = require "fs"
http   = require "https"
mime   = require "mime"
crypto = require "crypto"
parser = require "url"

{
  embedly : {


  # deal with extensions like:
  #   'com/LbobbpWTGJSa45Mhrb6g_y3YjLn5OthdnugrHZJQqom1eduFCnFmqdmOOZmUttP8hLg=h310'
  if ext.indexOf('com') > -1
    ext = 'jpeg'

  # replace nonalphanumeric characters
  ext = ext.replace(/\W+/g, '')

  md5 = crypto.createHash('md5')
  for i in [noExt, width, height]
    md5.update(i)

  digest   = md5.digest('hex')
  filename = "#{imagePath}/#{digest}.#{ext}"

  serveFile = (filename, res) ->
    fileStream = fs.createReadStream filename
    fileStream.pipe res

