File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,11 +117,16 @@ async function autoResize (options: {
117117} ) {
118118 const { sharpInstance, metadata, newSize, destination } = options
119119
120- // Portrait mode targeting a landscape, apply some effect on the image
121- const sourceIsPortrait = metadata . width <= metadata . height
120+ // Portrait/square input to landscape target
121+ const sourceIsPortraitOrSquare = metadata . width <= metadata . height
122122 const destIsPortraitOrSquare = newSize . width <= newSize . height
123123
124- if ( sourceIsPortrait && ! destIsPortraitOrSquare ) {
124+ // Portrait source to landscape destination
125+ // Or portrait source to landscape destination
126+ if (
127+ ( sourceIsPortraitOrSquare && ! destIsPortraitOrSquare ) ||
128+ ( ! sourceIsPortraitOrSquare && destIsPortraitOrSquare )
129+ ) {
125130 const foregroundImage = sharpInstance . clone ( )
126131 . resize ( newSize . width , newSize . height , { fit : 'inside' } )
127132
You can’t perform that action at this time.
0 commit comments