Php 其中我';我在下面的代码中旋转图像时出错了?
我正在修正图像的旋转。为此,我写了以下代码,但它不工作,我没有得到新的形象。为什么会这样 代码如下:Php 其中我';我在下面的代码中旋转图像时出错了?,php,image,function,reference,parameter-passing,Php,Image,Function,Reference,Parameter Passing,我正在修正图像的旋转。为此,我写了以下代码,但它不工作,我没有得到新的形象。为什么会这样 代码如下: $new_file_name = "demo_file.jpeg" $new_image = image_fix_orientation($_FILES, $new_file_name); function image_fix_orientation(&$image, $filename) { $image = imagerotate($image, array_values
$new_file_name = "demo_file.jpeg"
$new_image = image_fix_orientation($_FILES, $new_file_name);
function image_fix_orientation(&$image, $filename) {
$image = imagerotate($image, array_values([0, 0, 0, 180, 0, 0, -90, 0, 90])[@exif_read_data($filename)['Orientation'] ?: 0], 0);
}
谢谢将
返回
添加到您的函数中:
function image_fix_orientation(&$image, $filename) {
$image = imagerotate($image, array_values([0, 0, 0, 180, 0, 0, -90, 0, 90])[@exif_read_data($filename)['Orientation'] ?: 0], 0);
return $image;
}
image\u fix\u orientation
不返回任何内容。然而,您将结果分配给$new\u image
。