@@ -64,6 +64,8 @@ export default async function compress (file, options) {
6464
6565 const origExceedMaxSize = tempFile . size > maxSizeByte
6666 const sizeBecomeLarger = tempFile . size > file . size
67+ // console.log('original file size', file.size)
68+ // console.log('current file size', tempFile.size)
6769
6870 // check if we need to compress or resize
6971 if ( ! origExceedMaxSize && ! sizeBecomeLarger ) {
@@ -81,6 +83,8 @@ export default async function compress (file, options) {
8183 while ( remainingTrials -- && ( currentSize > maxSizeByte || currentSize > sourceSize ) ) {
8284 const newWidth = origExceedMaxSize ? canvas . width * 0.95 : canvas . width
8385 const newHeight = origExceedMaxSize ? canvas . height * 0.95 : canvas . height ;
86+ // console.log('current width', newWidth);
87+ // console.log('current height', newHeight);
8488 [ newCanvas , ctx ] = getNewCanvasAndCtx ( newWidth , newHeight )
8589
8690 ctx . drawImage ( canvas , 0 , 0 , newWidth , newHeight )
@@ -98,8 +102,6 @@ export default async function compress (file, options) {
98102 setProgress ( Math . min ( 99 , Math . floor ( ( renderedSize - currentSize ) / ( renderedSize - maxSizeByte ) * 100 ) ) )
99103 }
100104
101- // garbage clean canvas for safari
102- // ref: https://bugs.webkit.org/show_bug.cgi?id=195325
103105 cleanupCanvasMemory ( canvas )
104106 cleanupCanvasMemory ( newCanvas )
105107 cleanupCanvasMemory ( maxWidthOrHeightFixedCanvas )
0 commit comments