我创建缩略图,通过大量的图片循环,当我找到一个大的图像,我得到:imagejpeg内存耗尽
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes)
现在我已经知道如何与规避此:
ini_set('memory_limit', '-1');
我想知道的是为什么它耗尽了记忆!是否有一些调试工具能够准确显示内存何时耗尽?具体来说,这将显示我是否有变数/数组正在杀死我的记忆?
或者,是否有更好的方式来调整其他图像则:
$thumb=imagecreatetruecolor($newwidth,$newheight);
$source=imagecreatefromjpeg($imgfile);
imagecopyresampled($thumb,$source,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($thumb,$destinationfile,85);
?
非常感谢!
添加更多内存或处理较小的图像。这是gdlib常见的问题,这就是为什么我更喜欢imagemagick。 – elias 2010-04-19 15:27:05