-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: calculates correct aspect ratio dimensions on sharp based files (#…
…8510) Fixes #8317 Sharp based images are auto-oriented based on the EXIF data i.e. `.rotate()`. This can be problematic when resizing images as the `originalAspectRatio` calculation we do in the `imageResizer` can become incorrect if the files dimensions are rotated from sharp. For example, uploading an `ios` based image with dimensions of 3024 x 4032 will be auto rotated to 4032 x 3024 because the exif data gives the image an orientation of `6` - which means it needs to be rotated 90 degrees clockwise. As a result, the original aspect ratio goes from being `0.75` to `1.3333` - which is incorrect. This PR preserves the original aspect ratio to properly resize images based on the original dimensions - not the sharp based dimensions.
- Loading branch information
1 parent
f2284f3
commit 9d05b82
Showing
3 changed files
with
25 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.