I wrote this code:
$filename = "some/path/where/the/file/can/be/found.some_extension"; $buffer = file_get_contents($filename); $finfo = new finfo(FILEINFO_MIME_TYPE); var_dump($finfo->buffer($buffer)); finfo_close($finfo);
Possible outputs:
"image/jpeg", "image/png", "image/gif", "image/x-ms-bmp"
I would like to know what are the possible outputs of $finfo->buffer($buffer) if the file is png, gif, bmp or jpg?
I saw here a returnMIMEType , which, for example, will not detect "image/x-ms-bmp" as bmp.
Lajos arpad
source share