Solarpitch Posted November 11, 2007 Share Posted November 11, 2007 Hey, I am currently using the below script to try and resize and image if its too large but it doesn't seem to be uploading correctly, rather it just uploads the full size image. Is this the correct way to implement this script syntax wise? I think I've gone wrong somewhere! $image1 = $_FILES['image1']['tmp_name']; if($_FILES['image1']['tmp_name'] != ""){ list($width, $height, $type, $attr) = getimagesize($_FILES['image1']['tmp_name']); move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); if(($width > $height) && ($width > 800)) { $height = (($height/$width) * 800); $width = 800; $resize = "true"; } else if (($height > $width) && ($height > 800)) { $width = (($width/$height) * 800); $height = 800; $resize = "true"; } if ($resize == "true") { $new_w = 760; $new_h = 500; $resize = imagecreatetruecolor($width, $height); $im = imagecreatefromjpeg($image1); imagecopyresampled($resize, $im, 0, 0, 0, 0, $width, $height, $new_w, $new_h); imagejpeg($resize, $new_source, $quality); $newsize1 = $im; $new1 = "true"; } } Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 11, 2007 Share Posted November 11, 2007 is $width always greater than $height and $width always > 800 ? 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.