• 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: Accepting image drags from Safari & Firefox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accepting image drags from Safari & Firefox


  • Subject: Re: Accepting image drags from Safari & Firefox
  • From: Andreas Mayer <email@hidden>
  • Date: Mon, 6 Jun 2005 03:14:36 +0200


Am 3. Jun 2005 um 18:25 Uhr schrieb Jonathan del Strother:

I'm having trouble finding a way that reliably works for all situations (eg when the image is surrounded by link tags, I get the link destination rather than the image URL)

I don't see this problem.

How would you get a link from the pasteboard if you are looking for an image?

This seems to work for me:


if ([[pboard types] containsObject:NSTIFFPboardType]) {
pictureData = [pboard dataForType:NSTIFFPboardType];
newImage = [[[NSImage alloc] initWithData:pictureData] autorelease];
} else if ([[pboard types] containsObject:NSPICTPboardType]) {
pictureData = [pboard dataForType:NSPICTPboardType];
newImage = [[[NSImage alloc] initWithData:pictureData] autorelease];
} else if ([[pboard types] containsObject:NSFilenamesPboardType]) {
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
if (sourceDragMask & NSDragOperationGeneric) {
imagePath = [files objectAtIndex:0];
if (imagePath) {
imagePath = [[NSFileManager defaultManager] resolveAliasFile:imagePath];
}
}
}



Andreas _______________________________________________ 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: Accepting image drags from Safari & Firefox
      • From: Steven Kramer <email@hidden>
References: 
 >Accepting image drags from Safari & Firefox (From: Jonathan del Strother <email@hidden>)

  • Prev by Date: unkillable LoginItem possible?
  • Next by Date: Where to find _objc_insertMethods
  • Previous by thread: Re: Accepting image drags from Safari & Firefox
  • Next by thread: Re: Accepting image drags from Safari & Firefox
  • Index(es):
    • Date
    • Thread