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"; } } Link to comment https://forums.phpfreaks.com/topic/76899-image-resize-query/ 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 ? Link to comment https://forums.phpfreaks.com/topic/76899-image-resize-query/#findComment-389395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.