chore: resize 100x100 to 28x28
This commit is contained in:
parent
aa3e0b59c1
commit
6c07c7ea1e
@ -12,8 +12,25 @@ class OrdersView {
|
||||
[...document.querySelectorAll('.orders-window .canvases canvas')].map((canv, index) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
canv.toBlob(blob => {
|
||||
let blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
const img = new Image();
|
||||
img.src = blobUrl;
|
||||
|
||||
img.onload = () => {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 28;
|
||||
canvas.height = 28;
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, 0, 0, 28, 28);
|
||||
|
||||
canvas.toBlob((blob) => {
|
||||
// blobUrl = URL.createObjectURL(blob);
|
||||
formData.append(`file-${index}`, blob,`file-${index}.png`);
|
||||
resolve();
|
||||
}, 'image/png');
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user