I'm currently using ImageMagick to determine the resolution of images uploaded to the website. By calling ImageMagick's "identify" on the command line it takes about 0.42 seconds to determine a 1MB JPEG's resolution along with the fact that it's a JPEG. I find that a bit slow.
Using the Imagick PHP library is even slower as it attemps to load the whole 1MB in memory before doing any treatment to the image (in this case, simply determining its size and type).
Are there any solutions to speed up this process of determining which file type and which image resolution an arbitrary image file has? I can live with it only supporting JPEG and PNG. It's important to me that the file type is determined by looking at the file's headers and not simply the extension.
Edit: The solution can be a command-line tool UNIX called by PHP, much like the way I'm using ImageMagick at the moment