Skip to content

Commit

Permalink
Return a properly oriented image in the working dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Van Metre committed Apr 2, 2013
1 parent 3894cf2 commit 1f7e4e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Classes/ELCImagePicker/ELCImagePickerController.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ - (void)selectedAssets:(NSArray *)assets
NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init]; NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
[workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"]; [workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"];
ALAssetRepresentation *assetRep = [asset defaultRepresentation]; ALAssetRepresentation *assetRep = [asset defaultRepresentation];

CGImageRef imgRef = [assetRep fullScreenImage]; CGImageRef imgRef = [assetRep fullScreenImage];
UIImage *img = [UIImage imageWithCGImage:imgRef UIImage *img = [UIImage imageWithCGImage:imgRef
scale:[UIScreen mainScreen].scale scale:[UIScreen mainScreen].scale
orientation:(UIImageOrientation)assetRep.orientation]; orientation:UIImageOrientationUp];
[workingDictionary setObject:img forKey:@"UIImagePickerControllerOriginalImage"]; [workingDictionary setObject:img forKey:@"UIImagePickerControllerOriginalImage"];
[workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"]; [workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"];


Expand Down

0 comments on commit 1f7e4e4

Please sign in to comment.