 		destinationHeight: "=?"
 		autocrop: "=?"
 		ratio: "=?"
-		type: "=?"
 	link: (scope, element, attributes) ->
 		scope.dropText = "Drop picture here"
 		scope.state = "step-1"

			throw "Can't initialize cropme: destinationWidth needs to be lower than width"
		if scope.ratio and not scope.height
			scope.height = scope.destinationHeight
		scope.type ||= "png"

	template: """
		<div

			scope.croppedHeight = scope.heightCropZone / zoom
			$timeout ->
				ctx.drawImage imageEl, scope.xCropZone / zoom, scope.yCropZone / zoom, scope.croppedWidth, scope.croppedHeight, 0, 0, scope.croppedWidth, scope.croppedHeight
				base64ImageData = canvasEl.toDataURL('image/jpeg').replace("data:image/jpeg;base64,", "")
				raw = $window.atob base64ImageData
				blob = new Blob [raw], {type: "image/jpeg"}
				$rootScope.$broadcast "cropme", blob
]

