Solarpitch Posted November 11, 2007 Share Posted November 11, 2007 Hi, Just wondering how I would go about using the imagedestroy() function in the below script? Its something i havent used before but when I try to upload images it seems to run out of memory. $max = 800; if($_FILES['image1']['tmp_name'] != ""){ list($width, $height, $type, $attr) = getimagesize($_FILES['image1']['tmp_name']); move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); $copy1 = $image1; if(($width > $height) && ($width > $max)) { $height = (($height/$width) * $max); $width = $max; $resize = "true"; } else if (($height > $width) && ($height > $max)) { $width = (($width/$height) * $max); $height = $max; $resize = "true"; } if ($resize == "true") { $destination_width = 760; $destination_height = 500; $newcopy1 = new hft_image($copy1); $size=getimagesize($image1); $newcopy1->resize($destination_width, $destination_height, '-'); $newsize1 = $folder.$timest."AAresized.jpg"; $newcopy1->output_resized($newsize1, "JPEG"); $new1 = "true"; unlink($image1); } if($new1 !== "true"){$newsize1 = $copy1;} $destination_width = 160; $destination_height = 110; $imagecop1 = new hft_image($newsize1); $sz=getimagesize($newsize1); $imagecop1->resize($destination_width, $destination_height, '-'); $image1thumb = $folder.$timest."AA"."THUMB.jpg"; $imagecop1->output_resized($image1thumb, "JPEG"); $destination_width = 235; $destination_height = 170; $imagecop2 = new hft_image($newsize1); $sz=getimagesize($newsize1); $imagecop2->resize($destination_width, $destination_height, '-'); $mainthumb = $folder.$timest."MAIN"."THUMB.jpg"; $imagecop2->output_resized($mainthumb, "JPEG"); } Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted November 11, 2007 Share Posted November 11, 2007 imageCreate(); This is always used when making an image! imageDestroy(); Is always used to stop making an image! So this would be used at the end of your script that makes that perticular image. Hope this helps Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.