From 3b6ec285c55e94b0da41cdcf24c3a78835326fef Mon Sep 17 00:00:00 2001 From: "Libor M." Date: Tue, 31 Dec 2024 11:31:26 +0100 Subject: [PATCH] fixed a potential issue in the minimized library when detecting the orientation of JPEG images #2827 --- CHANGELOG.md | 1 + src/DocMeasure.js | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 829c10d7e..5a5b4e9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Reverted to the original `pdfkit` package, moving away from `@foliojs-fork` - Update pdfkit to 0.16.0 +- Fixed a potential issue in the minimized library when detecting the orientation of JPEG images ## 0.3.0-beta.14 - 2024-12-23 diff --git a/src/DocMeasure.js b/src/DocMeasure.js index 69613b015..79eeebbcf 100644 --- a/src/DocMeasure.js +++ b/src/DocMeasure.js @@ -131,11 +131,9 @@ class DocMeasure { let imageSize = { width: image.width, height: image.height }; - if (image.constructor.name === 'JPEG') { - // If EXIF orientation calls for it, swap width and height - if (image.orientation > 4) { - imageSize = { width: image.height, height: image.width }; - } + // If EXIF orientation calls for it, swap width and height + if (image.orientation > 4) { + imageSize = { width: image.height, height: image.width }; } this.measureImageWithDimensions(node, imageSize);