Php 识别图像是横向的还是纵向的

Php 识别图像是横向的还是纵向的,php,image,image-processing,Php,Image,Image Processing,如何识别和PHP脚本存储在同一文件夹中的图像是横向还是纵向?我需要实现此功能: if ($dir = @opendir($folder)) { while ($file = readdir($dir)) { if (in_array(strtolower(FileExt($file)), $extensions)) { if (!is_dir($file)) { if

如何识别和PHP脚本存储在同一文件夹中的图像是横向还是纵向?我需要实现此功能:

if ($dir = @opendir($folder))
{
    while ($file = readdir($dir))
    {
        if (in_array(strtolower(FileExt($file)), $extensions))
        {
            if (!is_dir($file))
            {
                if (isLandsape($file))
                {
                    $files[] = $file;
                }
            }
        }
    }

    closedir($dir);
}
这样的函数:

function isLandsape($file)
{
  list($width, $height) = getimagesize($file);
  return $width > $height;
}
这样的函数:

function isLandsape($file)
{
  list($width, $height) = getimagesize($file);
  return $width > $height;
}
可能的重复可能的重复