Reputation: 5681
Been looking around and can't find a definite way to do this... I need to read the meta data from an image found at a certain URL. Is there a way to do this on the iphone?
Upvotes: 0
Views: 2229
Reputation: 5681
I tried using iphone-exif and it just wasn't working in my project. Saw a lot of people getting the same errors as me.
Good news is I found another solution...
NSDictionary *IPTCDict;
NSString *urlString = @"http://SOMEIMAGEURL.jpg";
NSMutableData *photoData = [NSMutableData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)photoData, NULL);
NSDictionary *metadata = (__bridge NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
NSLog(@"Meta: %@", metadata); //Will print out all the metadata
// Pulls out the IPTC data
IPTCDict = [metadata objectForKey:(NSString *)kCGImagePropertyIPTCDictionary];
NSLog(@"Caption: %@\nCopyright: %@", [IPTCDict objectForKey:@"Caption/Abstract"], [IPTCDict objectForKey:@"CopyrightNotice"]);
Upvotes: 1
Reputation:
Re-answer:
Try this: http://code.google.com/p/iphone-exif/
You should be able to fetch the image properties (metadata). Hope this helps :)
Upvotes: 1