title: Image is not downloading using file_get_contents
body: <p>I am using the below mentioned code to download image. </p>
  
  <pre><code>$image_url='http://www.abcd.com/I_298f02_4766792.jpg';
  
  $doc_root= $_SERVER['DOCUMENT_ROOT'];
  $image_upload_path = $doc_root . '/';
  $image_name2 = 'img-' . time() . '.jpg';
  
  $destination  = $image_upload_path . $image_name2;
  
  $data = file_get_contents($image_url);
  $file = fopen($destination, "w+");
  fputs($file, $data);
  fclose($file);
  </code></pre>
  
  <p>The above mentioned code is working fine in development environment to download image from any website. The code also works in live site to download images from other website except only one site. </p>
  
  <p>The image seems to be downloaded but whenever i am trying to open the image using any image viewer, an error message is being displayed which is given below.</p>
  
  <p><strong>Could not load image 'img-65456465.jpg'.
  Error interpreting JPEG image file (Not a JPEG file: starts with 0x3c 0x21)</strong></p>
  
  <p>I checked the error log as well but found no issue.
  I am not understanding why its image download functionality is not working with that particular website only.</p>
  
  <p>Note: 
  1) I checked that the original image type hosted in that website is JPEG only.</p>
  
  <p><strong>EDIT:</strong>
  When i am trying to view the downloaded image using browser, i found the below mentioned error.</p>
  
  <p>The image '<a href="http://www.my-live-site.com/folder/img-65456465.jpg" rel="nofollow">http://www.my-live-site.com/folder/img-65456465.jpg</a>' can not be displayed because it contains error.</p>
  
  <p>As per suggestion, i am providing the original website link.
  <strong>Website:</strong> <a href="http://www.funnyjunk.com/" rel="nofollow">http://www.funnyjunk.com/</a>
  <strong>Image:</strong> any image link from this website. For example <a href="http://static.fjcdn.com/pictures/The+smarterest.+Wow+a+description+I+could+say+anything+I_298f02_4766792.jpg" rel="nofollow">http://static.fjcdn.com/pictures/The+smarterest.+Wow+a+description+I+could+say+anything+I_298f02_4766792.jpg</a></p>
  
  <p>Any help on this will be appreciated.</p>