• 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: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)


  • Subject: Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
  • From: mmalcolm crawford <email@hidden>
  • Date: Fri, 29 Apr 2005 11:37:48 -0700


On Apr 29, 2005, at 11:24 AM, Marc Blatt wrote:

This may be something obvious that I am missing, but how do you save an image file (let's say jpeg) with Core Data into the object graph. The obvious way is storing by reference with an attribute that saves the string name. However, how would you actually store the image within the binary or sql file? Still trying to grasp Core Data's power...


It's not clear what you mean by "save an image file" in the context of your suggestion of "storing by reference with an attribute that saves the string name".


I assume you'll actually be storing the the image data as an NSData object, in which case you can specify a data attribute of an entity that holds the image data. If not, you can specify a string attribute that identifies a file location (obviously this is a little more fragile if files may be moved independently of your application).

If you want to store the image data in your file, first you should not use the XML store (as you already imply). Second, I would suggest that you actually use the SQLite store and if an entity conceptually has a large data blob as an attribute that you actually specify a separate entity for that attribute. For example, if a Person entity should have a 'photo' attribute, then create a Photo entity with just a single attribute -- the data -- and if you care a relationship back to the Person (typically modeling relationships in both directions is a Good Thing). Then create a relationship from the Person to the Photo entity. This will mean that photo data is only loaded from the persistent store if you actually use it.

mmalc

_______________________________________________
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


  • Follow-Ups:
    • Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
      • From: Jim Correia <email@hidden>
References: 
 >Saving Images with Core Data (i.e., JPEG, TIFF, etc.) (From: Marc Blatt <email@hidden>)

  • Prev by Date: NSBezierPath and line intersection
  • Next by Date: CoreData retain/release/delete
  • Previous by thread: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
  • Next by thread: Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
  • Index(es):
    • Date
    • Thread