constantine-fry / rebekka

Rebekka - FTP/FTPS client in Swift.
BSD 2-Clause "Simplified" License
87 stars 56 forks source link

How To Upload UIImage? #14

Closed jamesike closed 8 years ago

jamesike commented 8 years ago

Hi, I love using this framework and one thing I can't get my head around is how to upload a uiimage.I know you can upload a photo from your app bundle , but let's say I wanted to upload a uiimage? How would I go about doing that?

constantine-fry commented 8 years ago

Hi, UIImage is an object to present image in UI. Rebbeka uploads files from disk

You should use these two function to get NSData from UIImage and store on disk.

UIKIT_EXTERN  NSData * __nullable UIImagePNGRepresentation(UIImage * __nonnull image);                               // return image as PNG. May return nil if image has no CGImageRef or invalid bitmap format
UIKIT_EXTERN  NSData * __nullable UIImageJPEGRepresentation(UIImage * __nonnull image, CGFloat compressionQuality);  // return image as JPEG. May return nil if image has no CGImageRef or invalid bitmap format. compression is 0(most)..1(least)