title: Base64Encoded string in ios not decoding properly on server side using php
body: <p>I am converting image to NSdata using UIImageJPEGRepresentation(image, 1.0) and then encoding it to base64 using base64 helper class   </p>
  
  <pre><code>NSString *imageOne = [self encodeBase64WithData:[imageDict objectForKey:@"ImageOne"]];
  </code></pre>
  
  <p>and finally sending it to server using post method as json parameter and in server side using php method to decode it. </p>
  
  <pre><code>/* encode &amp; write data (binary) */ 
  $ifp = fopen($imageNameWithPath, "wb" ); 
  fwrite($ifp, base64_decode($base64ImageString)); 
  fclose($ifp); 
  </code></pre>
  
  <p>After decoding it, I am saving the file as jpeg image and the file is created with proper size and extension but problem is that when I open it, I get the DIMENSION OF IMAGE as 0X0 ..(problem is here)</p>
  
  <p>Server side script is correct as our android developer is also sending base64string and the image is saved as jpeg with proper size and dimension.</p>
  
  <p>This problem is only from iphone side when sending to server for decoding. I have decoded the image using my base64 helper class and it works fine on my iPhone device.</p>
  
  <pre><code>UIImageView *viewImage = [[UIImageView alloc] initWithImage:[UIImage imageWithData: [self decodeBase64WithString:[registerDataDict objectForKey:@"imageOne"]]]];          
  [self.view addSubview:viewImage];
  </code></pre>
  
  <p>Is the process followed by me correct on the device or do I need to change something? Help would be appreciated.</p>