     Photo.all (err, docs) ->
         async.eachSeries(docs, convert, cb)
 
-createThumb = (socket, cb) =>
+createThumb = (socket, cb) ->
     # Recover all file without thumb
-    File.withoutThumb (err, files) =>
+    File.withoutThumb (err, files) ->
         total_files = files.length
         # Create thumb and check progress
-        async.eachSeries files, (file, callback) =>
-            thumb file, () =>
+        async.eachSeries files, (file, callback) ->
+            thumb file, () ->
                 thumb_files += 1
                 percent = Math.floor((thumb_files / total_files) * 100)
                 # Emit thumb creation progress

thumb_files = 0

module.exports.onThumbCreation = () ->
    #return [true, 50]
    return [onThumbCreation, (thumb_files / total_files) * 100]

convertImage = (cb) ->
    convert = (doc, callback) ->

        , cb

# Create all requests and upload directory
module.exports.convert = (socket, done=->null) ->
    #convertImage (err) ->
    onThumbCreation = true
    createThumb socket, ->
        onThumbCreation = false
        done()
