getimagesize()
The geimagesize() function allows us to determine the dimensions of an image, as well as the file type e.g. JPG, GIF, PNG. and the HTTP Content Type. Though this function is listed under the GD and Image Functions, this function does not require the GD image library.
Usage
This function will return an array containing the image information including the HTTP Content Type or MIME type which helps deliver images with a valid content-type header, or FALSE if the image information was not retrieved.