) is intended for generating images which do not exceed the specified boundaries ($max_width and $max_height) under any circumstances, while maintaining the original aspect ratio.
The problem
This specification above is not met when following 3 conditions are given:
$max_height > $max_width
i.e. we want a resize which fits in portrait-shaped boundaries (e.g.$max_width = 240; $max_height = 800 )
$img_width > $img_height
i.e. original image is landscape (e.g.$img_width == 1200; $img_height == 900;)
$img_height > $max_height
i.e. original image's height is bigger than the specified boundary for height (e.g.$img_height == 900; $max_width = 800;)
Right now, the above scenario results in a generated image constrained by height, instead of by width, returning an image which does not fit in our portrait-shaped boundaries.
With the example data above, the resulting image is
final_width = 1067
final_height = 800
, while the desired outcome is
final_width = 240
final_height = 160
Proposal
I intend to make a pull request asap fixing this particular resize mode.
The theory
resizemin
resize mode (i.e.) is intended for generating images which do not exceed the specified boundaries (
$max_width
and$max_height
) under any circumstances, while maintaining the original aspect ratio.The problem
This specification above is not met when following 3 conditions are given:
$max_height > $max_width
i.e. we want a resize which fits in portrait-shaped boundaries (e.g.
$max_width = 240; $max_height = 800
)$img_width > $img_height
i.e. original image is landscape (e.g.
$img_width == 1200; $img_height == 900;
)$img_height > $max_height
i.e. original image's height is bigger than the specified boundary for height (e.g.
$img_height == 900; $max_width = 800;
)Right now, the above scenario results in a generated image constrained by height, instead of by width, returning an image which does not fit in our portrait-shaped boundaries.
With the example data above, the resulting image is
, while the desired outcome is
Proposal
I intend to make a pull request asap fixing this particular resize mode.