Does this detect the actual format of a file?
No file is read. The result comes from an extension or type lookup in the built-in list.
Check the conventional Content-Type for a plain filename or media type in a small reference list.
For a WebP image, the common Internet media type is image/webp. A filename extension is useful as a clue, and an application may also need to verify the actual bytes.
The reverse lookup ignores parameters after the first semicolon, such as charset=UTF-8. It lists the common extensions present in this reference.
No file is read. The result comes from an extension or type lookup in the built-in list.