Skip to content

Commit e7bb464

Browse files
author
achauchet
committed
Check getImage options on android
1 parent 566af95 commit e7bb464

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/imagepicker.android.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,16 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
208208
// TODO: Refactor to accomodate different scaling options
209209
// Right now, it just selects the smallest of the two sizes
210210
// and scales the image proportionally to that.
211-
let targetSize = options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight;
212-
while (!(this.matchesSize(targetSize, outWidth) ||
213-
this.matchesSize(targetSize, outHeight))) {
214-
outWidth /= 2;
215-
outHeight /= 2;
216-
scale *= 2;
211+
let targetSize = !options.maxWidth && options.maxHeight ? options.maxHeight :
212+
(!options.maxHeight && options.maxWidth ? options.maxWidth :
213+
(options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight));
214+
if (targetSize) {
215+
while (!(this.matchesSize(targetSize, outWidth) ||
216+
this.matchesSize(targetSize, outHeight))) {
217+
outWidth /= 2;
218+
outHeight /= 2;
219+
scale *= 2;
220+
}
217221
}
218222
}
219223
return scale;

0 commit comments

Comments
 (0)