Re: Core Data, NSImageView, and Thumbnailing
Re: Core Data, NSImageView, and Thumbnailing
- Subject: Re: Core Data, NSImageView, and Thumbnailing
- From: David Rocamora <email@hidden>
- Date: Fri, 25 Aug 2006 18:55:20 -0400
- Thread-topic: Core Data, NSImageView, and Thumbnailing
Thanks Chris! I think your thorough message will point me in the right
direction. I appreciate your response.
-David
On 8/25/06 6:52 PM, "Chris Hanson" <email@hidden> wrote:
> "How do I generate a thumbnail from an image?" really isn't a Core
> Data question; the fact that you're using Core Data isn't really
> relevant to it. However, there is a Core Data question lurking in
> the above once you figure out how to generate a thumbnail: How do
> you manage both an "image" attribute and a "thumbnail" attribute
> where the thumbnail is the only one you want to save?
>
> That has a fairly straightforward answer. Your image attribute
> should be marked transient in your data model. Either when your
> image is set, or when your managed object instance is saved, you
> should generate a thumbnail from the image and assign it to the
> thumbnail attribute. And either when your image is accessed, or when
> your managed object instance is awakened from a fetch, you should
> return your thumbnail data instead.
>
> What you're really doing here is using the thumbnail persistent
> attribute as a backing store for the image transient attribute. How
> to follow this pattern in the general case is described in the Core
> Data documentation; this is just a specific case. Other similar
> cases might be to have an NSURL as an attribute or an attribute
> representing a reference to a file.[1]
>
> Another interface-centric possibility -- which may be a lot easier,
> depending on your needs -- might be to write your own value
> transformer to apply to the NSImageView's data binding. When
> transforming from the image view's NSImage to an NSData, your value
> transformer could also turn the image into a thumbnail if it's too
> large.
>
> -- Chris
This message is the property of R/GA and contains information which may be privileged or confidential. It is meant only for the intended recipients and/or their authorized agents. If you believe you have received this message in error, please notify us immediately by return e-mail or by forwarding this message to email@hidden, and destroy any printed or electronic copies of the message. Any unauthorized use, dissemination, disclosure, or copying of this message or the information contained in it, is strictly prohibited and may be unlawful. Thank you.
_______________________________________________
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