mwaterfall / MWPhotoBrowser

A simple iOS photo and video browser with grid view, captions and selections.
MIT License
8.75k stars 2.72k forks source link

Display images from documents directory #6

Closed rahulskh closed 13 years ago

rahulskh commented 13 years ago

I am trying to take picture using camera and save the image to the documents directory. I am able to save the image to directory and also able to read it from the directory but not able to display the image. Below code to get the documents directory path and image.

NSArray searchPaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); _documentsPath = [searchPaths objectAtIndex: 0]; [_documentsPath retain]; // NSLog(@"Files in the documents Directory %@", _documentsPath); filenames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:_documentsPath error: NULL];
NSString
filename = [filenames objectAtIndex:0]; NSLog(@"files in documents Directory %@", filename);

Now the image that I get I want to pass it to Photos NSMutable array. Can anyone please assist to me achieve this? I will really appreciate it.

case 0: [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo2l" ofType:@"jpg"]]];

Thank you very much. Rahul-

mwaterfall commented 13 years ago

Hi Rahul,

This is an issue regarding your understanding of the Objective-C and Cocoa, rather than a problem with MWPhotoBrowser, so I unfortunately don't have the time to help you.

Best of luck!

Best regards, Michael

rahulskh commented 13 years ago

I figured it out. Thanks a lot!