On 8/15/06, chris smith <dmagick@xxxxxxxxx> wrote:
On 8/15/06, Tom Chubb <tomchubb@xxxxxxxxx> wrote: > I know this will be really simple, but I'm struggling to get my head round > the use of imagedestroy() > I have some code which uploads an image, resizes to create a smaller image > and thumbnail then deletes the source image. > My question is which images need to be destroyed? Straight from the manual: imagedestroy() frees any memory associated with image image. image is the image identifier returned by one of the image create functions, such as imagecreatetruecolor() So any time you call imagecreate* functions you need to also do an imagedestroy. In your case you need to add imagedestroy($target_id); imagedestroy($source_id); just before imagejpeg ($target_id,"$targetfile",$jpegqual); return true; }
Oops! Move those imagedestroy calls after imagejpeg but before the return ;) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php