Spaces:
Running
Running
BraydenMoore
commited on
Commit
•
ece9abb
1
Parent(s):
462a877
Update stylings
Browse files- web/static/script.js +4 -4
web/static/script.js
CHANGED
@@ -46,12 +46,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
46 |
|
47 |
const imageWidth = uploadedImage.width;
|
48 |
const imageHeight = uploadedImage.height;
|
49 |
-
|
50 |
// Create a canvas to draw cropped image
|
51 |
const canvas = document.createElement("canvas");
|
52 |
const ctx = canvas.getContext("2d");
|
53 |
-
canvas.width =
|
54 |
-
canvas.height =
|
55 |
|
56 |
let sourceX, sourceY, sourceWidth, sourceHeight;
|
57 |
|
@@ -69,7 +69,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
69 |
sourceX = 0;
|
70 |
}
|
71 |
|
72 |
-
ctx.drawImage(uploadedImage, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0,
|
73 |
|
74 |
const croppedImage = new Image();
|
75 |
croppedImage.src = canvas.toDataURL();
|
|
|
46 |
|
47 |
const imageWidth = uploadedImage.width;
|
48 |
const imageHeight = uploadedImage.height;
|
49 |
+
const imageSize = 300;
|
50 |
// Create a canvas to draw cropped image
|
51 |
const canvas = document.createElement("canvas");
|
52 |
const ctx = canvas.getContext("2d");
|
53 |
+
canvas.width = imageSize;
|
54 |
+
canvas.height = imageSize;
|
55 |
|
56 |
let sourceX, sourceY, sourceWidth, sourceHeight;
|
57 |
|
|
|
69 |
sourceX = 0;
|
70 |
}
|
71 |
|
72 |
+
ctx.drawImage(uploadedImage, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, imageSize, imageSize);
|
73 |
|
74 |
const croppedImage = new Image();
|
75 |
croppedImage.src = canvas.toDataURL();
|