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
https://forums.phpfreaks.com/topic/76801-imagedestroy-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.