Re: Image Destroy
| From: | chris smith | Date: | Tue, 15 Aug 2006 11:31:06 +0000 |
| Subject: | Re: Image Destroy | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240698@lists.php.net to get a copy of this message | ||
On 8/15/06, Tom Chubb <tomchubb@gmail.com> 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; } -- Postgresql & php tutorials http://www.designmagick.com/