Skip to content

Commit

Permalink
Properly calculate height of transformed images
Browse files Browse the repository at this point in the history
Fixes an issue where the height of a non-cropped image being transformed was being calculated as a percentage of the height rather than of the width.

#11837
  • Loading branch information
brianjhanson committed Aug 30, 2022
1 parent d3ea1fe commit aa26335
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed an issue where image dimensions could be calculated incorrectly. ([#11837](https://github.com/craftcms/cms/issues/11837))

## 3.7.53.1 - 2022-08-26

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ private function _dimensions($transform = null): array
return [$this->_width, $this->_height];
}

return $transformRatio > 1 ? [$this->_width, round($this->_height / $transformRatio)] : [round($this->_width * $transformRatio), $this->_height];
return $transformRatio > 1 ? [$this->_width, round($this->_width / $transformRatio)] : [round($this->_width * $transformRatio), $this->_height];
}

[$width, $height] = Image::calculateMissingDimension($transform->width, $transform->height, $this->_width, $this->_height);
Expand Down

0 comments on commit aa26335

Please sign in to comment.