Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin/camera): Fix scaling when setting only height #2123

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static Bitmap resize(Bitmap bitmap, final int width, final int height) {
} else if (width > 0) {
return Bitmap.createScaledBitmap(bitmap, width, (int) (width * 1/aspect), false);
} else if (height > 0) {
return Bitmap.createScaledBitmap(bitmap, (int)(height * 1/aspect), height, false);
return Bitmap.createScaledBitmap(bitmap, (int) (height * aspect), height, false);
}

return bitmap;
Expand Down
2 changes: 1 addition & 1 deletion ios/Capacitor/Capacitor/Plugins/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public class CAPCameraPlugin : CAPPlugin, UIImagePickerControllerDelegate, UINav
if settings.width > 0 {
size = CGSize.init(width: Int(settings.width), height: Int(settings.width * (1/aspect)))
} else if settings.height > 0 {
size = CGSize.init(width: Int(settings.height * (1/aspect)), height: Int(settings.height))
size = CGSize.init(width: Int(settings.height * aspect), height: Int(settings.height))
}
}

Expand Down