$image = new Imagick("image.jpg"); $height = $image->getImageHeight(); echo "Image height is: " . $height . " pixels";
$dir = "path/to/images/"; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $image = new Imagick($dir . $entry); $height = $image->getImageHeight(); echo $entry . " has a height of " . $height . " pixelsThis code loops through a directory of images, opens each one using Imagick, and retrieves their height using the `getImageHeight` function. The height is then printed to the screen along with the file name. Overall, the `getimageheight` function is a useful tool for determining the size of an image in PHP, and can be used in tandem with other Imagick functions to create dynamic image manipulation tools.
"; } } closedir($handle); }