display image from URL retrieved from ALAsset in iPhone

Viewed 85744

I am using a ALAsset Framework for accessing the files in the device's photo gallery.

So far I am able to access the thumbnail and display it.
I want to display the actual image in an image view but I am unable to figure out how to do this.

I tried using the URLs field in the ALAsset object but was unsuccessful.

Anybody knows how this can be done?

Here's some code where I was able to access the thumbnail and place it in a table cell:

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {


  static NSString *CellIdentifier = @"Cell";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  }
  //here 'asset' represents the ALAsset object


  asset = [assets objectAtIndex:indexPath.row];
       //i am accessing the thumbnail here
  [cell.imageView setImage:[UIImage imageWithCGImage:[asset thumbnail]]];
  [cell.textLabel setText:[NSString stringWithFormat:@"Photo %d", indexPath.row+1]];

  return cell;
}
4 Answers
Related