Load an image to UIImage from a file path to the asset library Load an image to UIImage from a file path to the asset library objective-c objective-c

Load an image to UIImage from a file path to the asset library


from the answer linked in my comment above:

    -(void)findLargeImage{    NSString *mediaurl = [self.node valueForKey:kVMMediaURL];    //    ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)    {        ALAssetRepresentation *rep = [myasset defaultRepresentation];        CGImageRef iref = [rep fullResolutionImage];        if (iref) {            largeimage = [UIImage imageWithCGImage:iref];            [largeimage retain];        }    };    //    ALAssetsLibraryAccessFailureBlock failureblock  = ^(NSError *myerror)    {        NSLog(@"booya, cant get image - %@",[myerror localizedDescription]);    };    if(mediaurl && [mediaurl length] && ![[mediaurl pathExtension] isEqualToString:AUDIO_EXTENSION])    {        [largeimage release];        NSURL *asseturl = [NSURL URLWithString:mediaurl];        ALAssetsLibrary* assetslibrary = [[[ALAssetsLibrary alloc] init] autorelease];        [assetslibrary assetForURL:asseturl                        resultBlock:resultblock                      failureBlock:failureblock];    }}


Try the following:(UIImage *)imageWithContentsOfFile:(NSString *)path


You also can use [myasset aspectRatioThumbnail] to get your image.