I would like to take an image from a URL:
http://imgur.com/gallery/ihHQvP1
and then convert it NSData so that I will be able to parse it up to the server. The server only accepts NSData and not image links. I have the following from the camera:
NSData *pictureData = UIImagePNGRepresentation([self scaleImage:activityImageView.image toSize:CGSizeMake(230, 230)]);
it is then put into a JSON format to send to the server:
jsonPostBody= [NSString stringWithFormat:@"{\"activity_id\":\"%@\",\"user_id\":\"%@\",\"activity_title\":\"%@\",\"activity_category_id\":\"%@\",\"activity_description\":\"%@\",\"activity_image\":\"%@\",\"activity_begindate\":\"%@\",\"activity_enddate\":\"%@\", \"activity_time\":\"%@\", \"activity_email\":\"%@\",\"activity_city\":\"%@\",\"activity_where\":\"%@\",\"gotooffer_url\":\"%@\",\"latitude\":\"%@\",\"longitude\":\"%@\"}",[editActivityDict valueForKey:@"activity_id"],singletonObj.userID,title,selectedCategoryString,discription,[Base64 encode:pictureData],begindateConvert,enddateConvert,milatryTime,@"",city,where,entersite,singletonObj.singletonlatitude,singletonObj.singletonlogitude];
NSString *urlString=[NSString stringWithFormat:@"%@%@",ROOT_URL,EDIT_ACTIVITY];
As you can see the variable for the picture being sent in the body post is:
[Base64 encode:pictureData]
Any Ideas?