       array.push(binary.charCodeAt(k))
     new Blob([new Uint8Array(array)], type: 'image/png')
 
+  setPreview: ->
+    @previewImage.attr('src', @dataURL)
+
   setBlob: ->
-    dataURL = @modalCropImg.cropper('getCroppedCanvas').toDataURL('image/png')
-    @croppedImageBlob = @dataURLtoBlob(dataURL)
+    @dataURL = @modalCropImg.cropper('getCroppedCanvas',
+        width: 200
+        height: 200
+      ).toDataURL('image/png')
+    @croppedImageBlob = @dataURLtoBlob(@dataURL)
 
   getBlob: ->
     @croppedImageBlob

  onUploadImageBtnClick: (e) =>
    e.preventDefault()
    @setBlob()
    @modalCrop.modal('hide')
    # @form.submit();

  onActionBtnClick: (btn) ->
    data = $(btn).data()

    @fileInput.trigger('click')

  onModalShow: =>
    self = @
    @modalCropImg.cropper(
      viewMode: 1
      center: false
