Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "EXFJpeg.h"
- - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
- NSLog(@"image picked %@ with info %@", image, editingInfo);
- NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
- EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
- [jpegScanner scanImageData: jpegData];
- EXFMetaData* exifData = jpegScanner.exifMetaData;
- EXFJFIF* jfif = jpegScanner.jfif;
- EXFTag* tagDefinition = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_DateTime]];
- //EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
- //EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
- id latitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLatitude]];
- id longitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLongitude]];
- id datetime = [exifData tagValue:[NSNumber numberWithInt:EXIF_DateTime]];
- id t = [exifData tagValue:[NSNumber numberWithInt:EXIF_Model]];
- ....
- ....
- - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
- // Try to get the original file.
- NSURL *originalFile = [info objectForKey:UIImagePickerControllerMediaURL];
- if (originalFile) {
- NSData *fileData = [NSData dataWithContentsOfURL:originalFile];
- }
- }
- -(void) imagePickerController:(UIImagePickerController *)picker
- didFinishPickingMediaWithInfo:(NSDictionary *)info
- {
- NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
- if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) {
- NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
- if (url) {
- ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) {
- CLLocation *location = [myasset valueForProperty:ALAssetPropertyLocation];
- // location contains lat/long, timestamp, etc
- // extracting the image is more tricky and 5.x beta ALAssetRepresentation has bugs!
- };
- ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) {
- NSLog(@"cant get image - %@", [myerror localizedDescription]);
- };
- ALAssetsLibrary *assetsLib = [[ALAssetsLibrary alloc] init];
- [assetsLib assetForURL:url resultBlock:resultblock failureBlock:failureblock];
- }
- }
- - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
- id thumbnailView = [[[[[[[[[[picker.view subviews]
- objectAtIndex:0] subviews]
- objectAtIndex:0] subviews]
- objectAtIndex:0] subviews]
- objectAtIndex:0] subviews]
- objectAtIndex:0];
- NSString *fullSizePath = [[[thumbnailView selectedPhoto] fileGroup] pathForFullSizeImage];
- NSString *thumbnailPath = [[[thumbnailView selectedPhoto] fileGroup] pathForThumbnailFile];
- NSLog(@"%@ and %@", fullSizePath, thumbnailPath);
- }
- - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
- // Try to get the original file.
- NSURL *originalFile = [info objectForKey:UIImagePickerControllerMediaURL];
- if (originalFile) {
- NSData *fileData = [NSData dataWithContentsOfURL:originalFile];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement