From 67e56a9f6a72519568570f67e8cc7da8851abea6 Mon Sep 17 00:00:00 2001 From: yashpalgoyal1304 Date: Sat, 26 Nov 2022 23:29:11 +0530 Subject: [PATCH 1/4] Set image-minimizer to specify image width ... Fix https://github.com/TeamNewPipe/NewPipe/issues/9469 for portrait like orientations --- .github/workflows/image-minimizer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image-minimizer.js b/.github/workflows/image-minimizer.js index 80cc5294c..93ec7a170 100644 --- a/.github/workflows/image-minimizer.js +++ b/.github/workflows/image-minimizer.js @@ -86,7 +86,7 @@ module.exports = async ({github, context}) => { if (shouldModify) { wasMatchModified = true; console.log(`Modifying match '${match}'`); - return `${g1}`; + return `${g1}`; } console.log(`Match '${match}' is ok/will not be modified`); From 7746188a8030623407888b2a308dbcb6f047d0d4 Mon Sep 17 00:00:00 2001 From: yashpalgoyal1304 Date: Sun, 27 Nov 2022 01:56:53 +0530 Subject: [PATCH 2/4] Fix value of width --- .github/workflows/image-minimizer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image-minimizer.js b/.github/workflows/image-minimizer.js index 93ec7a170..fa9706faa 100644 --- a/.github/workflows/image-minimizer.js +++ b/.github/workflows/image-minimizer.js @@ -86,7 +86,7 @@ module.exports = async ({github, context}) => { if (shouldModify) { wasMatchModified = true; console.log(`Modifying match '${match}'`); - return `${g1}`; + return `${g1}`; } console.log(`Match '${match}' is ok/will not be modified`); From e8b6b09314b043d878a3b962895888910ecc9f56 Mon Sep 17 00:00:00 2001 From: yashpalgoyal1304 Date: Sun, 27 Nov 2022 02:06:01 +0530 Subject: [PATCH 3/4] Resolve scoping issue to get values of probeResult --- .github/workflows/image-minimizer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-minimizer.js b/.github/workflows/image-minimizer.js index fa9706faa..f4f132a72 100644 --- a/.github/workflows/image-minimizer.js +++ b/.github/workflows/image-minimizer.js @@ -55,6 +55,7 @@ module.exports = async ({github, context}) => { return match; } + let probeAspectRatio = 0; let shouldModify = false; try { console.log(`Probing ${g2}`); @@ -76,7 +77,8 @@ module.exports = async ({github, context}) => { } console.log(`Probing resulted in ${probeResult.width}x${probeResult.height}px`); - shouldModify = probeResult.height > IMG_MAX_HEIGHT_PX && (probeResult.width / probeResult.height) < MIN_ASPECT_RATIO; + probeAspectRatio = probeResult.width / probeResult.height; + shouldModify = probeResult.height > IMG_MAX_HEIGHT_PX && probeAspectRatio < MIN_ASPECT_RATIO; } catch(e) { console.log('Probing failed:', e); // Immediately abort @@ -86,7 +88,7 @@ module.exports = async ({github, context}) => { if (shouldModify) { wasMatchModified = true; console.log(`Modifying match '${match}'`); - return `${g1}`; + return `${g1}`; } console.log(`Match '${match}' is ok/will not be modified`); From 3e98bfe6de085f5be2f331df0caaedbbb87d0ad2 Mon Sep 17 00:00:00 2001 From: yashpalgoyal1304 Date: Sun, 27 Nov 2022 03:22:37 +0530 Subject: [PATCH 4/4] Minimize not-so-long images too --- .github/workflows/image-minimizer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image-minimizer.js b/.github/workflows/image-minimizer.js index f4f132a72..df1a30f9b 100644 --- a/.github/workflows/image-minimizer.js +++ b/.github/workflows/image-minimizer.js @@ -88,7 +88,7 @@ module.exports = async ({github, context}) => { if (shouldModify) { wasMatchModified = true; console.log(`Modifying match '${match}'`); - return `${g1}`; + return `${g1}`; } console.log(`Match '${match}' is ok/will not be modified`);