title: PHP processing image with MIME type application/x-gzip
body: <p>In my application I process links to various websites and download images that are present on those websites into my database. I have trouble processing <a href="http://www.inc.com/uploaded_files/image/lemonade-970_29794.jpg" rel="nofollow">this image</a>. It looks like it's JPEG, but <code>imagecreatefromjpeg()</code> returns an error</p>
  
  <blockquote>
    <p>Not a JPEG file: starts with 0x1f 0x8b</p>
  </blockquote>
  
  <p>I finally found working solution to get true file type, which is</p>
  
  <pre><code>$file = "http://www.inc.com/uploaded_files/image/lemonade-970_29794.jpg"
  $file_info = new finfo(FILEINFO_MIME);
  echo $file_info-&gt;buffer(file_get_contents($file));
  </code></pre>
  
  <p>which returns <code>application/x-gzip; charset=binary</code></p>
  
  <p>I'm not sure what to do with that. I guess it's somehow cached into gzip and the browser can work with that and that's why the image is normally loaded inside browser. But what can be done in PHP to download that file into some usual image type file? Thanks</p>