-Photo = require '../models/photo'
 async = require 'async'
 fs = require 'fs'
 qs = require 'qs'
 im = require 'imagemagick'
 multiparty = require 'multiparty'
+
+Photo = require '../models/photo'
 sharing = require './sharing'
+downloader = require '../helpers/downloader'
 
 app = null
 module.exports.setApp = (ref) -> app = ref

        onError = (err) -> next err if err

        if req.photo._attachments?[which]
            stream = req.photo.getFile which, onError
        else if req.photo.binary?[which]
            stream = req.photo.getBinary which, onError
        else
            return res.sendfile './server/img/error.gif'


        #     if couchres.headers.etag is req.headers['if-none-match']
        #         myres.send 304



# Get mid-size version of the picture
