Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么是与convert-auto-oriente命令行开关等效的PHPImagick类_Php_Imagick_Exif - Fatal编程技术网

什么是与convert-auto-oriente命令行开关等效的PHPImagick类

什么是与convert-auto-oriente命令行开关等效的PHPImagick类,php,imagick,exif,Php,Imagick,Exif,目前,我通过在PHP文件中执行一个convert-auto-orient系统调用来直接使用,以基于。出于一致性原因,我想使用。是否有任何函数等效于 提前谢谢 没有现成的东西能做到这一点。这里有一个方法,我总是使用自动旋转图像 function resample($jpgFile, $thumbFile, $width, $orientation) { // Get new dimensions list($width_orig, $height_orig) = getimages

目前,我通过在PHP文件中执行一个
convert-auto-orient
系统调用来直接使用,以基于。出于一致性原因,我想使用。是否有任何函数等效于


提前谢谢

没有现成的东西能做到这一点。这里有一个方法,我总是使用自动旋转图像

function resample($jpgFile, $thumbFile, $width, $orientation) {
    // Get new dimensions
    list($width_orig, $height_orig) = getimagesize($jpgFile);
    $height = (int) (($width / $width_orig) * $height_orig);
    // Resample
    $image_p = imagecreatetruecolor($width, $height);
    $image   = imagecreatefromjpeg($jpgFile);
    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
    // Fix Orientation
    switch($orientation) {
        case 3:
            $image_p = imagerotate($image_p, 180, 0);
            break;
        case 6:
            $image_p = imagerotate($image_p, -90, 0);
            break;
        case 8:
            $image_p = imagerotate($image_p, 90, 0);
            break;
    }
    // Output
    imagejpeg($image_p, $thumbFile, 90);
}