Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/imagepicker.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
// TODO: Refactor to accomodate different scaling options
// Right now, it just selects the smallest of the two sizes
// and scales the image proportionally to that.
let targetSize = options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight;
while (!(this.matchesSize(targetSize, outWidth) ||
this.matchesSize(targetSize, outHeight))) {
outWidth /= 2;
outHeight /= 2;
scale *= 2;
let targetSize = !options.maxWidth && options.maxHeight ? options.maxHeight :
(!options.maxHeight && options.maxWidth ? options.maxWidth :
(options.maxWidth < options.maxHeight ? options.maxWidth : options.maxHeight));
if (targetSize) {
while (!(this.matchesSize(targetSize, outWidth) ||
this.matchesSize(targetSize, outHeight))) {
outWidth /= 2;
outHeight /= 2;
scale *= 2;
}
}
}
return scale;
Expand Down