Permalink
Browse files

Merge pull request #17 from thedarkbark/master

Fix for sideways images from camera on iOS 4.x
  • Loading branch information...
2 parents d67c12a + f87cfcd commit 8052a42e47671ea775594ea35fc84389ed45a0e6 jvanmetre committed Mar 26, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 Classes/ELCImagePickerController.m
View
7 Classes/ELCImagePickerController.m
@@ -30,7 +30,12 @@ -(void)selectedAssets:(NSArray*)_assets {
NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
[workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"];
- [workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]] forKey:@"UIImagePickerControllerOriginalImage"];
+ ALAssetRepresentation *assetRep = [asset defaultRepresentation];
+ CGImageRef imgRef = [assetRep fullScreenImage];
+ UIImage *img = [UIImage imageWithCGImage:imgRef
+ scale:assetRep.scale
+ orientation:(UIImageOrientation)assetRep.orientation];
+ [workingDictionary setObject:img forKey:@"UIImagePickerControllerOriginalImage"];
[workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"];
[returnArray addObject:workingDictionary];

0 comments on commit 8052a42

Please sign in to comment.