Search
Close this search box.
Search
Close this search box.

PHP Snippets

How to check if an image is portrait or landscape using PHP

$size = getimagesize($filename); 
$width = $size[0]; 
$height = $size[1]; 
$aspect = $height / $width; 
if ($aspect >= 1) $mode = "vertical"; 
else $mode = "horizontal";