On Fri, Mar 13, 2009 at 8:45 AM, Joe Turner <joetur...@me.com> wrote: > Here: > > NSImage *original = [NSImage imageNamed:NSImageNameComputer]; > [original setSize:NSMakeSize(10.0f, 10.0f)]; > NSData *image = [original TIFFRepresentation]; > NSBitmapImageRep *imageRep = [NSBitmapImageRep > imageRepWithData:image]; > NSData *finalData = [imageRep > representationUsingType:NSPNGFileType properties:nil]; > NSDictionary *txtRecord = [NSDictionary > dictionaryWithObject:finalData forKey:@"image"]; > NSData *data = [NSNetService > dataFromTXTRecordDictionary:txtRecord]; > if (data) > NSLog(@"Data is not nil!"); > [netService setTXTRecordData:data];
That all looks fine (except for the manipulation of the "original" image, which could be a shared object; make a copy, manipulate that) but I just remembered something from the Zeroconf spec: "The format of each constituent string within the DNS TXT record is a single length byte, followed by 0-255 bytes of text data." In other words, the total length of each TXT record entry, counting the key, the value, and the equals sign that separates them, cannot exceed 255 bytes. You'll either have to *really* shrink your picture, or find another way to transmit it. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com