title: php: jpeg mime type – not detected for photoshop jpegs with quality 12
body: <p>I'm creating a small image uploader form, nothing fancy. Only upload allowed are JPG files – this is checked by the php script with this:</p>
  
  <pre><code>$filesize = getimagesize($targetFile);
  if($filesize['mime'] != 'image/jpeg') { ... }
  </code></pre>
  
  <p>This works as expected for most jpg files, but I've come across some that are rejected. I checked these images with this site: <a href="http://mime.ritey.com/" rel="nofollow noreferrer">http://mime.ritey.com/</a>
  and found out that it just returns a <code>"Unknown MIME type"</code> instead of the expected <code>"image/jpeg"</code>.</p>
  
  <p>Digging deeper with that non-working image, I found out it was saved with photoshop and quality setting 12 (not the "save for web" dialog, just the regular save dialog).</p>
  
  <p>If I save this image with quality 11 or lower, it is recognized as "image/jpeg". Next, if I take that quality 11 image and re-save it with level 12 again, it's not working anymore ...</p>
  
  <p>From what I remember, quality level 12 is not officially specified for jpgs, it's an invention by Adobe. So I guess this may cause the problem.</p>
  
  <p>Still, those jpgs are out there, so is there a way to identify them with php as legitimate jpeg files? Is there some other mime type for this flavour? Or some other way to check they are jpegs (except for the filename suffix, that's not reliable enough for my case). </p>