Re: Base64 encoding of NSImage

2012-07-02 Thread Andreas Grosam
On 02.07.2012, at 17:53, Jens Alfke wrote: > > On Jul 2, 2012, at 5:08 AM, Andreas Grosam wrote: > >> Well, embedding an image encoded in base64 in a JSON document is not that >> "RESTful" anyway. > > Sure it is. Plenty of REST-based APIs do this sort of thing (CouchDB and Atom > both come t

Re: Base64 encoding of NSImage

2012-07-02 Thread Kyle Sluder
On Jul 2, 2012, at 8:53 AM, Jens Alfke wrote: > > (Of course on the other end it's trickier because how does the decoder know > what strings should be decoded to NSData and which should be left alone? YAML > has type annotations that provide for this, but JSON doesn't.) All the more reason to

Re: Base64 encoding of NSImage

2012-07-02 Thread Jens Alfke
On Jul 2, 2012, at 5:08 AM, Andreas Grosam wrote: > Well, embedding an image encoded in base64 in a JSON document is not that > "RESTful" anyway. Sure it is. Plenty of REST-based APIs do this sort of thing (CouchDB and Atom both come to mind.) The REST principles don't dictate any particular t

Re: Base64 encoding of NSImage

2012-07-02 Thread Andreas Grosam
On 01.07.2012, at 17:23, Alexander Hartner wrote: > I am looking at available option to send an NSImage to a webserver. I came > across gSoap however its licensing model makes it not suitable. Using REST / > JSON seems like an easy option however NSDATA does not seem to be supported > by the J

Re: Base64 encoding of NSImage

2012-07-01 Thread Jens Alfke
On Jul 1, 2012, at 12:16 PM, David Riggle wrote: > This is what I use. Short and sweet. 10.7-only, though. (And not available on iOS.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator commen

Re: Base64 encoding of NSImage

2012-07-01 Thread David Riggle
This is what I use. Short and sweet. @implementation NSData (Base64) - (NSData *)dataWithBase64Encoding { CFDataRef retval = NULL; SecTransformRef encodeTrans = SecEncodeTransformCreate(kSecBase64Encoding, NULL); if (encodeTrans != NULL) { if (SecTransform

Re: Base64 encoding of NSImage

2012-07-01 Thread Richard Altenburg (Brainchild)
Op 1 jul. 2012, om 19:38 heeft Jens Alfke het volgende geschreven: > It's always better to use an already-tested library than to roll your own, if > it's feasible. Often you are not sure about the status of code you find online. Has it really been tested? Does it still work on my system, with m

Re: Base64 encoding of NSImage

2012-07-01 Thread Jens Alfke
On Jul 1, 2012, at 9:33 AM, Richard Altenburg (Brainchild) wrote: > If you want to be sure which one works for you, it is probably best to read > how Base64 encoding actually works, maybe you find out you can just as easily > roll your own solution. Especially on a fast Mac desktop, it would no

Re: Base64 encoding of NSImage

2012-07-01 Thread Jens Alfke
On Jul 1, 2012, at 8:23 AM, Alexander Hartner wrote: > I am looking at available option to send an NSImage to a web server. The simplest way would jut be to PUT the raw JPEG/PNG/whatever data to a URL on the server. No need to encode it. > I came across gSoap however its licensing model makes

Re: Base64 encoding of NSImage

2012-07-01 Thread Jim Zajkowski
On Sun, Jul 1, 2012 at 1:05 PM, Kyle Sluder wrote: > On Sun, Jul 1, 2012, at 11:23 PM, Alexander Hartner wrote: >> I am looking at available option to send an NSImage to a webserver. > If you're in control over both the client and server, I'd suggest > avoiding sending the image data over JSON.

Re: Base64 encoding of NSImage

2012-07-01 Thread Kyle Sluder
On Sun, Jul 1, 2012, at 11:23 PM, Alexander Hartner wrote: > I am looking at available option to send an NSImage to a webserver. I > came across gSoap however its licensing model makes it not suitable. > Using REST / JSON seems like an easy option however NSDATA does not seem > to be supported by t

Re: Base64 encoding of NSImage

2012-07-01 Thread Richard Altenburg (Brainchild)
If you want to be sure which one works for you, it is probably best to read how Base64 encoding actually works, maybe you find out you can just as easily roll your own solution. Especially on a fast Mac desktop, it would not have to be the worlds' most efficient solution, it will be fast anyways

Re: Base64 encoding of NSImage

2012-07-01 Thread Tom Hohensee
Try here. it is a category for nsdata in this post. http://www.thohensee.com/?page_id=435 Tom Sent from my iPhone On Jul 1, 2012, at 10:26 AM, Alexander Hartner wrote: I am looking at available option to send an NSImage to a webserver. I came across gSoap however its licensing model makes it

Re: Base64 encoding of NSImage

2012-07-01 Thread Alex Zavatone
I think that only cocoa collections can be supported by the JSON serializer. Even CLLocations aren't supported since they consist of structs. On Jul 1, 2012, at 11:23 AM, Alexander Hartner wrote: > I am looking at available option to send an NSImage to a webserver. I came > across gSoap however

Re: Base64 encoding of NSImage

2012-07-01 Thread Richard Altenburg (Brainchild)
I think the answers given here will help you out: http://stackoverflow.com/questions/392464/any-base64-library-on-iphone-sdk [[[Brainchild alloc] initWithName:@"Richard Altenburg"] saysBestRegards]; Op 1 jul. 2012, om 17:23 heeft Alexander Hartner het volgende geschreven: > I am looking at ava

Base64 encoding of NSImage

2012-07-01 Thread Alexander Hartner
I am looking at available option to send an NSImage to a webserver. I came across gSoap however its licensing model makes it not suitable. Using REST / JSON seems like an easy option however NSDATA does not seem to be supported by the JSON Serialiser. The one remaining option I considered was to