Re: scaling images

From: Date: Thu, 20 Sep 2007 15:56:04 +0000
Subject: Re: scaling images
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-262299@lists.php.net to get a copy of this message
Sorry my message was cut off. Yes I want to scale to 300 x 200px before I upload the image to my folder. Here is my code so far. thanks, H. $imageinfo = getimagesize($_FILES['userfile']['tmp_name']); echo $x=$imageinfo[0]; echo $y=$imageinfo[1]; $newwidth = 300; $newheight = 200; // Load $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($_FILES['userfile']['tmp_name']); // Resize imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); // Output $myimage = imagejpeg($thumb); $target_path = "../property_images/$property_id/".basename( $_FILES['userfile']['name']); $img_url= $property_id."/".basename( $_FILES['userfile']['name']); if(move_uploaded_file($myimage, $target_path)) { /* echo "The file ". basename( $_FILES['userfile']['name']). " has been uploaded";*/ } else{ echo "There was an error uploading the file, please try again!"; }

« previous php.general (#262299) next »