oldfart commited on
Commit
4a0bd66
·
1 Parent(s): 6be31bc

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +4 -22
index.html CHANGED
@@ -62,28 +62,10 @@
62
  formatDisplay.textContent = file.type;
63
 
64
  // Convert and create a download link
65
- const reader = new FileReader();
66
- reader.onload = function (e) {
67
- const img = new Image();
68
- img.onload = function () {
69
- const canvas = document.createElement('canvas');
70
- canvas.width = img.width;
71
- canvas.height = img.height;
72
-
73
- const ctx = canvas.getContext('2d');
74
- ctx.drawImage(img, 0, 0);
75
-
76
- canvas.toBlob(function (blob) {
77
- const url = URL.createObjectURL(blob);
78
- downloadLink.href = url;
79
- downloadLink.style.display = 'block';
80
- }, targetFormat);
81
- };
82
-
83
- img.src = e.target.result;
84
- };
85
-
86
- reader.readAsDataURL(file);
87
  }
88
  }
89
  </script>
 
62
  formatDisplay.textContent = file.type;
63
 
64
  // Convert and create a download link
65
+ const blob = file.slice(0, file.size, targetFormat);
66
+ const url = URL.createObjectURL(blob);
67
+ downloadLink.href = url;
68
+ downloadLink.style.display = 'block';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
  }
71
  </script>