How to stop PHP iMagick auto-rotating images based on EXIF 'orientation' data

前端 未结 5 1419
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 23:52

Currently working with PHP and iMagick to develop a poster printing Web application.

This is the example image I am using to test upload/image editing features of th

5条回答
  •  自闭症患者
    2020-12-03 00:02

    This code in orrd's excellent answer requires iMagick version 6.3+.:

    $image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);

    Works perfectly and takes care of os/device orientation differences. Would not work with 6.2.

    I had coded to get device. Here in case someone needs it.

    $ua = $_SERVER['HTTP_USER_AGENT'];
    $strcut = stristr($ua, '(')."
    "; $textlen = strpos($strcut,";"); $deviceos = substr($strcut,1,($textlen-1)); echo "Device O/S: * $deviceos"."
    ";

提交回复
热议问题