Jump to content

Imagedestroy() function?


Solarpitch

Recommended Posts

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");

    			
		}	

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.