我創建縮略圖,通過大量的圖片循環,當我找到一個大的圖像,我得到: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