         # This image is smaller than the canvas
         info.trgHeight = info.srcHeight
         info.trgWidth = info.srcWidth
-
       else
         # Image is bigger and needs rescaling
-        if srcRatio > trgRatio
-          info.srcHeight = file.height
-          info.srcWidth = info.srcHeight * trgRatio
+        if (srcRatio > 1) #horizontal
+          info.trgWidth = info.optWidth
+          info.trgHeight = info.optHeight / srcRatio
         else
-          info.srcWidth = file.width
-          info.srcHeight = info.srcWidth / trgRatio
+          info.trgWidth = info.optWidth * srcRatio
+          info.trgHeight = info.optHeight
+              
 
       info.srcX = (file.width - info.srcWidth) / 2
       info.srcY = (file.height - info.srcHeight) / 2

    else
      @options.accept.call this, file, done

  addFile: (file) ->
    file.upload =
      progress: 0
      # Setting the total upload size to file.size for the beginning
      # It's actual different than the size to be transmitted.
      total: file.size
      bytesSent: 0
    @files.push file

    file.status = Dropzone.ADDED

    @emit "addedfile", file

    @_enqueueThumbnail file

    @accept file, (error) =>
      if error

    else
      throw new Error "This file can't be queued because it has already been processed or was rejected."

  _thumbnailQueue: [ ]
  _processingThumbnail: no
  _enqueueThumbnail: (file) ->
