Looktrne Posted June 21, 2007 Share Posted June 21, 2007 I am trying to add imagecopyresampled to my photo upload page so it scaled all images that are too big to 800 by 600 THE CODE FOLLOWS if ($size[0] > $max_image_width || $size[1] > $max_image_height){$nrs=1;} else {$nrs=0;} if(man_MIME2Ext($_FILES["filename_1"]['type']) != "") { $file_source = $member_code."_$number.".man_MIME2Ext($_FILES["filename_1"]['type']); upload_file($_FILES["filename_1"]['tmp_name'], "photos/$file_source", man_MIME2Ext($_FILES["filename_1"]['type'])); if ($nrs=1){ // ## Will this next line properly asign the imagefile? ### $image = "photos/$file_source"; header("Content-type: image/jpeg"); if(substr($image, -3)=="jpg" || substr($image, -3)=="JPG"){$im = imagecreatefromjpeg($image);} elseif(substr($image, -3)=="gif" || substr($image, -3)=="GIF"){$im = imagecreatefromgif($image);} elseif(substr($image, -3)=="png" || substr($image, -3)=="PNG"){$im = imagecreatefrompng($image);} $x = 800; $y = 600; $yyy=0; $xxx=0; $imw = imagecreatetruecolor($x,$y); imagecopyresampled($imw, $im, 0,0,0,0,$x,$y,imagesx($im), imagesy($im)); } // Do I need an output file in here somewhere? please some suggestions on how to fix this up Link to comment https://forums.phpfreaks.com/topic/56610-imagecopyresampled-whats-wrong-with-this-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.