什么是与convert-auto-oriente命令行开关等效的PHPImagick类
目前,我通过在PHP文件中执行一个什么是与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
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);
}