When you take photos with the iPhone camera, they are automatically geo-tagged.
I have written the following code to take photos in my GPS Recorder app, but the photos are not being geo-tagged.
What am I doing wrong? Should I be using a completely different method, or is there some way I can modify my code to add the geo-tag and other data to the EXIF info?
Note that self.photoInfo is the info dictionary returned by this delegate method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
Here's the code:
UIImage *oImage = [self.photoInfo objectForKey:UIImagePickerControllerOriginalImage];
CGSize size = oImage.size;
oImage = [CameraController imageWithImage:oImage
scaledToSize:CGSizeMake(size.width/2.56,size.height/2.56)];
NSDictionary *info = [[NSDictionary alloc] initWithObjectsAndKeys:
oImage, @"image", titleString, @"title", nil];
TrailTrackerAppDelegate *t = (TrailTrackerAppDelegate *)[[UIApplication sharedApplication] delegate];
[NSThread detachNewThreadSelector:@selector(saveImage:) toTarget:t withObject:info];
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Here is a photo taken with the Camera, which has all the good EXIF data: http://www.flickr.com/photos/33766454@N02/3978868900/
And here is on taken with my code, which doesn't have the EXIF data: http://www.flickr.com/photos/33766454@N02/3978860380/