$width; } public static function isImageLandscape($imagePath) { if (!file_exists($imagePath)) { return false; } $imageInfo = getimagesize($imagePath); if ($imageInfo === false) { return false; } list($width, $height) = $imageInfo; return $width > $height; } public static function getImageOrientation($imagePath) { if (!file_exists($imagePath)) { return 'unknown'; } $imageInfo = getimagesize($imagePath); if ($imageInfo === false) { return 'unknown'; } list($width, $height) = $imageInfo; if ($width > $height) { return 'landscape'; } elseif ($height > $width) { return 'portrait'; } else { return 'square'; } } }