Retrieve image orientation in PHP

后端 未结 6 1082
闹比i
闹比i 2021-02-04 06:54

How can I get the image orientation (landscape or portrait) of an image (JPEG or PNG) in PHP?

I created a php site where users can upload pictures. Before I scale them

6条回答
  •  無奈伤痛
    2021-02-04 07:08

    I suppose you could check if the Image width is longer than the length for Landscape and for Portrait if the Length is longer than width.

    You can do that with a simple IF / ELSE statement.

    You could also use the function: Imagick::getImageOrientation

    http://php.net/manual/en/imagick.getimageorientation.php

提交回复
热议问题