Re: Can't Convert Image on Disk to NSData for Core Data
Re: Can't Convert Image on Disk to NSData for Core Data
- Subject: Re: Can't Convert Image on Disk to NSData for Core Data
- From: Timothy Larkin <email@hidden>
- Date: Mon, 29 Aug 2005 11:46:03 -0400
On Aug 29, 2005, at 11:19 AM, Ian G. Gillespie wrote:
I can't convert an image on disk to a NSData object and store the
data in my Core Data model.
I solved a similar situation. I get an NSImage from a URL
image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:
[element stringValue]]];
Then a make a thumbnail from it, which is stored with
[itemEntity setValue:[NSArchiver
archivedDataWithRootObject:thumbnail] forKey:@"image"];
The image appears in a column of an NSTableView that has a value
binding to the "image" key, and a value transformer
"NSUnarchiveFromData".
I'm not sure how this differs from what you are trying, but this works.
Tim Larkin
Abstract Tools
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden