旋转大尺寸图像在php中出现错误

旋转大尺寸图像在php中出现错误,php,php-gd,Php,Php Gd,当我使用rotateImage()函数旋转小图像时,它工作正常。但如果是大文件(5500 X 3000px),它会给出错误。如何在php中处理大型图像 // Content type header('Content-type: image/jpeg'); // Load $source = imagecreatefromjpeg($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); imagejpeg($rotate

当我使用rotateImage()函数旋转小图像时,它工作正常。但如果是大文件(5500 X 3000px),它会给出错误。如何在php中处理大型图像

// Content type
header('Content-type: image/jpeg');
// Load
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
imagejpeg($rotate,'new.jpg');

当我们旋转图像时,它的内存大小和尺寸会增加,并且会出现内存不足错误。我想旋转图像类似于照片店的旋转操作,每件事情都与原始图像相同。

我的猜测是,如果它在小图像上工作,而不是在大图像上工作,则内存会耗尽。如果是这种情况,您可以使用增加
php.ini
中的内存限制


您还应该运行脚本,确保没有不必要地复制内容。尝试就地修改。

什么错误?你的代码是什么?问题是:在旋转的情况下,图像尺寸增加,图像内存大小也增加。//内容类型标题('Content-type:image/jpeg');//加载$source=imagecreatefromjpeg($filename);//旋转$Rotate=imagerotate($source,$degrees,0);谢谢李维。它的内存限制问题。但当我们旋转图像时,为什么它的尺寸和内存大小会增加?我们能控制吗?