Re: [SOLVED] Retrieving URL from NSImage
Re: [SOLVED] Retrieving URL from NSImage
- Subject: Re: [SOLVED] Retrieving URL from NSImage
- From: Dominik Pich <email@hidden>
- Date: Mon, 16 Apr 2007 19:30:42 +0200
I'd make it category though :)
-SetUrl
-url
Am Apr 16, 2007 um 7:16 PM schrieb Jim Turner:
Thanks to Dan Waylonis for the idea: simply subclass NSImage and
save the
URL manually.
@interface JTImage : NSImage
{
NSURL *jt_url;
NSString *jt_path;
}
-(NSURL *)imageURL;
-(NSString *)imagePath;
@end
@implementation JTImage
-(id) initByReferencingFile:(NSString *)filename
{
if( self = [super initByReferencingFile:filename] )
{
jt_path = [filename retain];
}
return( self );
}
-(id) initByReferencingURL:(NSURL *)url
{
if( self = [super initByReferencingURL:url] )
{
jt_url = [url retain];
}
return( self );
}
-(void) dealloc
{
if( jt_url != nil )
[jt_url release];
if( jt_path != nil )
[jt_path release];
[super dealloc];
}
-(NSString *)imagePath
{
return( jt_path );
}
-(NSURL *)imageURL
{
return( jt_url );
}
@end
On 4/10/07 10:32 AM, "Jim Turner" <email@hidden> wrote:
I'm trying to create what is essentially a custom file browser for
a large
repository of InDesign documents and associated artwork contained
within.
Artwork has both a preview low-resolution version and a high-
resolution,
ready-for-print version, all stored on a file server with indexing
and
organization of the underlying data (advertiser, run dates, etc)
done in
MySQL.
One of the features I'd like to offer is the ability to drag the
artwork
from my app to Photoshop for editing without having my app
actually open the
high-res version and offer it up to the pasteboard. So while I'm
able to do
the drag-and-drop, I incur a huge penalty loading (sometimes
dozens of)
100Mb+ graphics that the user may or may not ever need.
So my though was that if I knew where the low-res graphic was
located, I
could fiddle with what the pasteboard is going after and offer up
the actual
stored high-res graphic file instead.
I suppose I could keep track of all of this manually, but
referencing the
image's URL seemed such a simple and clean solution.
Jim
On 4/10/07 1:54 AM, "Scott Stevenson" <email@hidden>
wrote:
On Apr 9, 2007, at 8:33 AM, Jim Turner wrote:
Is there a way to retrieve the URL an NSImage refers to when
created with
initByReferencingURL:?
The docs say that when an NSImage is archived, only the URL is
saved, so
there has to be a way to retrieve what it is. I just hope it's a
public
interface.
Or does it make more sense to ask the question: When NSImage is
sent a
setDataRetained:, where's that data being saved and can I
retrieve it?
I don't think you can get at this stuff through the public NSImage
interface.
Can you describe what you're trying to do in a big picture sense?
There are a lot of image classes available in Mac OS X, and it's
possible something other than NSImage might fit better.
- Scott
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Jim Turner
Senior Programmer/Analyst
The Des Moines Register
515/284-8223
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden