Is there a way to determine the file type by directly scanning the file itself, rather than reading it from the header? I know it seems like overkill…but I don’t want someone to be able to edit the mime-type of a file (say changing it from “image/png” to “image/gif”) and then do the same thing with the file extension, without me being able to tell.
I experimented with this by using the ImageMagick method [B]setImageFormat[B]writeImage[B]imagecreatefromgif
Is there any kind of test that will return false if the file contents don’t agree with the mime-type?