We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37a5718 commit c63187eCopy full SHA for c63187e
1 file changed
tools/image-compressor/app.html
@@ -222,6 +222,7 @@ <h1>图片压缩工具</h1>
222
const downloadLink = document.getElementById('download');
223
let image = new Image();
224
let originalSize = 0;
225
+ let currentBlobUrl = null;
226
227
function formatBytes(bytes) {
228
if (!bytes) return '--';
@@ -280,9 +281,13 @@ <h1>图片压缩工具</h1>
280
281
}, format, quality);
282
}
283
}).then((blob) => {
284
+ // 释放之前的 blob URL
285
+ if (currentBlobUrl) {
286
+ URL.revokeObjectURL(currentBlobUrl);
287
+ }
288
const url = URL.createObjectURL(blob);
289
+ currentBlobUrl = url;
290
const previewImg = new Image();
- previewImg.onload = () => URL.revokeObjectURL(url);
291
previewImg.src = url;
292
preview.innerHTML = '';
293
preview.appendChild(previewImg);
0 commit comments