Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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
Php 其中我';我在下面的代码中旋转图像时出错了?_Php_Image_Function_Reference_Parameter Passing - Fatal编程技术网

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