| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2012-07-28 09:42 UTC] BenjaminBeck at gmx dot de
 Description: ------------ PHP function "mime_content_type" returns wrong mime type: "application/octet-stream" instead of "image/jpeg" on a jpg image. I checked the magic bytes (jpeg header) of the file with a hex editor and it looked fine to me. the image is taken by a smartfone (HTC 7 Mozart T8698). this is the image: http://dl.dropbox.com/u/25310351/7.jpeg Test script: --------------- $res = mime_content_type("7.jpg"); var_dump($res); Expected result: ---------------- image/jpeg Actual result: -------------- application/octet-stream PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 03:00:01 2025 UTC | 
This is because your picture is not standard JPEG/JFIF but instead JPEG/EXIF. The command-line Linux 'file' program doesn't understand it either: 7:03am x220:~> file 7.jpeg 7.jpeg: Claris clip art? You can get it using: var_dump(image_type_to_mime_type(exif_imagetype("7.jpeg"))) which produces: image/jpeg But yes, we should support non-JFIF jpeg files as well here.