Permalink
Browse files

Corrected image resize parameters to fix stretching

  • Loading branch information...
1 parent b0a2620 commit d343249378a474b9a12bca23f5e91986c5e09bd7 Deepwinter committed Mar 24, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 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);

0 comments on commit d343249

Please sign in to comment.