Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Corrected image resize parameters to fix stretching

  • Loading branch information...
commit d343249378a474b9a12bca23f5e91986c5e09bd7 1 parent b0a2620
@deepwinter authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 Wildflowers of Detroit Iphone/CameraViewController.m
View
11 Wildflowers of Detroit Iphone/CameraViewController.m
@@ -274,11 +274,16 @@ - (IBAction) didTouchSendButton:(id)sender{
//Medium size
CGSize mediumSize;
- mediumSize.width = 480;
- mediumSize.height = 320;
+ if(currentImage.size.width > currentImage.size.height){
+ mediumSize.width = 480;
+ mediumSize.height = 320;
+ } else {
+ mediumSize.width = 320;
+ mediumSize.height = 480;
+ }
UIGraphicsBeginImageContext(mediumSize);
- [currentImage drawInRect:CGRectMake(0, 0, 480, 320)];
+ [currentImage drawInRect:CGRectMake(0, 0, mediumSize.width, mediumSize.height)];
UIImage* mediumImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * mediumImageDataJpeg = UIImageJPEGRepresentation(mediumImage, .8);
Please sign in to comment.
Something went wrong with that request. Please try again.