• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't Convert Image on Disk to NSData for Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Can't Convert Image on Disk to NSData for Core Data (From: "Ian G. Gillespie" <email@hidden>)

  • Prev by Date: hyperlinktext cursor is not changing untill focus on textview
  • Next by Date: Re: Setting the DPI of an NSBitmapImageRep
  • Previous by thread: Can't Convert Image on Disk to NSData for Core Data
  • Next by thread: Unarchive Data from URL (was Can't Convert Image...)
  • Index(es):
    • Date
    • Thread