Skip to content

Commit bf76dd7

Browse files
committed
Use existing maxWidth/maxHeight options if present in aspectRatio calculations rather than overriding them
1 parent a238dfb commit bf76dd7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/load-image-scale.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
}
7373
}
7474
newOptions.crop = true
75-
width = img.naturalWidth || img.width
76-
height = img.naturalHeight || img.height
75+
width = options.maxWidth || img.naturalWidth || img.width
76+
height = options.maxHeight || img.naturalHeight || img.height
7777
if (width / height > aspectRatio) {
7878
newOptions.maxWidth = height * aspectRatio
7979
newOptions.maxHeight = height

0 commit comments

Comments
 (0)