1
我试图调整图像使用PHP。当我调整图像大小超过500像素时,我不断收到此错误,不知道为什么。imagecopyresampled()期望参数2是资源,null给出
这里的错误:
imagecopyresampled() expects parameter 2 to be resource, null given
这里是我的代码无法正常工作:
$resize = new ResizeImage($targetFile);
$resize->resizeTo(1800, 1800);
$resize->saveImage($xxlFile, 100);
这里是我的代码,做工作:
$resize = new ResizeImage($targetFile);
$resize->resizeTo(500, 500);
$resize->saveImage($xxlFile, 100);
我的剧本是打破在这里:
$this->newImage = imagecreatetruecolor($this->resizeWidth, $this->resizeHeight);
imagecopyresampled($this->newImage, $this->image, 0, 0, 0, 0, $this->resizeWidth, $this->resizeHeight, $this->origWidth, $this->origHeight);
我的图像是5616×3744.为什么不能调整1800像素宽?
谢谢。
你是最棒的。这就是它的内存问题。感谢解决方案。 – LargeTuna