Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
10 changes: 10 additions & 0 deletions packages/image_picker/ios/Classes/FLTImagePickerImageUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ + (UIImage *)scaledImage:(UIImage *)image
scale:1
orientation:UIImageOrientationUp];

// Swap width and height when source image orientation is left/right
if ([image imageOrientation] == UIImageOrientationLeft ||
[image imageOrientation] == UIImageOrientationRight ||
[image imageOrientation] == UIImageOrientationLeftMirrored ||
[image imageOrientation] == UIImageOrientationRightMirrored) {
double temp = width;
width = height;
height = temp;
}

UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), NO, 1.0);
[imageToScale drawInRect:CGRectMake(0, 0, width, height)];

Expand Down