File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 7474 newOptions . crop = true
7575 width = img . naturalWidth || img . width
7676 height = img . naturalHeight || img . height
77- if ( width / height > aspectRatio ) {
78- newOptions . maxWidth = height * aspectRatio
79- newOptions . maxHeight = height
77+ if ( options . orientationAwareAspectRatio && height > width ) {
78+ if ( height / width > aspectRatio ) {
79+ newOptions . maxWidth = height
80+ newOptions . maxHeight = height * aspectRatio
81+ } else {
82+ newOptions . maxWidth = width / aspectRatio
83+ newOptions . maxHeight = width
84+ }
8085 } else {
81- newOptions . maxWidth = width
82- newOptions . maxHeight = width / aspectRatio
86+ if ( width / height > aspectRatio ) {
87+ newOptions . maxWidth = height * aspectRatio
88+ newOptions . maxHeight = height
89+ } else {
90+ newOptions . maxWidth = width
91+ newOptions . maxHeight = width / aspectRatio
92+ }
8393 }
8494 return newOptions
8595 }
You can’t perform that action at this time.
0 commit comments