gdavis / FGallery-iPhone

Objective-C based gallery for iPhones
583 stars 144 forks source link

Is there a way to show images from NSDocumentDirectory ? #43

Closed sumantanf closed 11 years ago

sumantanf commented 11 years ago
NSMutableArray *fullPathImageArray=[[NSMutableArray alloc]init];    

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

filePathsArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:NULL];

filePathsArray = [filePathsArray filteredArrayUsingPredicate:
                  [NSPredicate predicateWithFormat:@"pathExtension ==[c] %@", @"jpg"]];

for (int i=0; i<[filePathsArray count]; i++) 
{
    NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent:   [filePathsArray objectAtIndex:i]];

    [fullPathImageArray insertObject:fullPathToFile atIndex:i];
 }

When fullPathImageArray is used as PhotoSourceTypeLocal nothing is displayed in the gallery.

sumantanf commented 11 years ago

Just followed issue number 36 and got the desired result