Skip to content

Commit

Permalink
Avoid altering image proportion
Browse files Browse the repository at this point in the history
  • Loading branch information
luphaz committed Jul 16, 2018
1 parent 4eb8362 commit 468e907
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,13 @@ func imageCalculations(o *Options, inWidth, inHeight int) float64 {
switch {
// Fixed width and height
case o.Width > 0 && o.Height > 0:
factor = math.Min(xfactor, yfactor)
// By default, we will alterate the image proportion in order to fulfill the resize requirement
// This parameter check is not necessary but aim to explain the behaviour we expect regarding resize
if o.Crop || !o.Embed {
factor = math.Min(xfactor, yfactor)
} else {
factor = math.Max(xfactor, yfactor)
}
// Fixed width, auto height
case o.Width > 0:
if o.Crop {
Expand Down

0 comments on commit 468e907

Please sign in to comment.