mirror of
				https://github.com/Investigamer/cardconjurer.git
				synced 2025-10-31 07:10:42 -05:00 
			
		
		
		
	Fixed watermarks and added automatic image cropping
This commit is contained in:
		| @@ -8,6 +8,7 @@ | ||||
|         function autocrop(url, destination) { | ||||
|             //Create image, size canvas, draw image | ||||
|             var imgTempSetSymbol = new Image() | ||||
|             imgTempSetSymbol.crossOrigin = "anonymous" | ||||
|             imgTempSetSymbol.src = url | ||||
|             imgTempSetSymbol.onload = function() { | ||||
|                 if (imgTempSetSymbol.width > 0 && imgTempSetSymbol.height > 0) { | ||||
| @@ -41,8 +42,8 @@ | ||||
|                 height = pix.y[n] - pix.y[0] | ||||
|                 var cropped = cropContext.getImageData(pix.x[0], pix.y[0], width + 1, height + 1) | ||||
|                 //Resizes the canvas and draws cropped image | ||||
|                 cropCanvas.width = width | ||||
|                 cropCanvas.height = height | ||||
|                 cropCanvas.width = width + 1 | ||||
|                 cropCanvas.height = height + 1 | ||||
|                 cropContext.putImageData(cropped, 0, 0) | ||||
|                 //Saves the newly cropped image to the given image | ||||
|                 destination.src = cropCanvas.toDataURL() | ||||
|   | ||||
| @@ -5,6 +5,7 @@ function loadImage(event, destination, arg) { | ||||
| 		reader.onload = function() { | ||||
| 			var dataURL = reader.result | ||||
| 			destination.src = dataURL | ||||
| 			destination.cropped = false | ||||
| 		} | ||||
| 		reader.readAsDataURL(input.files[0]) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kyle
					Kyle