
Untitled
By: a guest on
May 28th, 2012 | syntax:
None | size: 1.95 KB | hits: 15 | expires: Never
How to retrieve image from the specified image path in Iphone
- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary
{
imageView.image=info;
[UIPicker dismissModalViewControllerAnimated:YES];
NSLog(@"UImage path= %@",imageView.image);
NSData* imageData = UIImagePNGRepresentation(imageView.image);
NSString* imageName = @"MyImage.png";
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
[imageData writeToFile:fullPathToFile atomically:NO];
NSLog(@"Image path = %@",fullPathToFile);
}
Image path=document = /Users/rr-mac/Library/Application Support/iPhone Simulator/4.3/Applications/46C716D0-13E9-4DF2-BC46-F1071DFCE14C/Documents/MyImage.png
UIImage *image = [UIImage imageWithContentsOfFile:fullPathToFile];
NSString *imageName = @"MyImage.png";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPathToFile];
self.imageView.image = image;
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
imageView.image = [UIImage imageNamed:fullPathToFile];
yourImageView.image = [UIImage imageNamed:@"MyImage.png"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docdirpath = [paths objectAtIndex:0];