我在以下代码中旋转图像时犯了错误


Where I'm making the mistake in rotating the image in following code?

我正在修复图像的旋转。为此,我编写了以下代码,但它不起作用,也没有获得新图像。为什么会这样?

以下是代码:

$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);
}

谢谢

return添加到函数中:

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;
}