title: Encode an image URL to NSData
body: <p>I would like to take an image from a URL:</p>
  
  <pre><code>http://imgur.com/gallery/ihHQvP1
  </code></pre>
  
  <p>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:</p>
  
  <pre><code> NSData *pictureData = UIImagePNGRepresentation([self scaleImage:activityImageView.image toSize:CGSizeMake(230, 230)]);
  </code></pre>
  
  <p>it is then put into a JSON format to send to the server:</p>
  
  <pre><code>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];
  </code></pre>
  
  <p>As you can see the variable for the picture being sent in the body post is:</p>
  
  <pre><code>[Base64 encode:pictureData]
  </code></pre>
  
  <p>Any Ideas?</p>