Just a warning: don't use Eero Niemi's code (identifyImage with pingImage) if you just want to get the image width and height, because it will actually be slower than reading the whole image into memory - about 10x slower!
Correct code should be:
<?php
$image = new Imagick();
$image->pingImage($file);
$width = $image->getImageWidth();
$height = $image->getImageHeight();
?>
(this is around 15 times faster than reading the image in memory)