Skip to content

Commit

Permalink
cropToSize: take image orientation into account
Browse files Browse the repository at this point in the history
Fixes #43
  • Loading branch information
Nyx0uf committed Feb 17, 2014
1 parent 5fc65c3 commit a89beb9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Categories/UIImage+Resizing.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ -(UIImage*)cropToSize:(CGSize)newSize usingMode:(NYXCropMode)cropMode
break;
}

if (self.imageOrientation == UIImageOrientationLeft || self.imageOrientation == UIImageOrientationLeftMirrored || self.imageOrientation == UIImageOrientationRight || self.imageOrientation == UIImageOrientationRightMirrored)
{
CGFloat temp = x;
x = y;
y = temp;
}

CGRect cropRect = CGRectMake(x * self.scale, y * self.scale, newSize.width * self.scale, newSize.height * self.scale);

/// Create the cropped image
Expand Down

0 comments on commit a89beb9

Please sign in to comment.