1 ){ // landscape if( $type=="main" ) $neww = $mainSize; // main size remains the same if( $type=="extra" ){ if( $ratio > $panoramicLandscapeRatio ){ // panoramic photo // calculate new width, but watch out for new height not to be larger than $panoramicSize2 $neww = ( $panoramicSize1/$ratio > $panoramicSize2 ) ? $panoramicSize2*$ratio : $panoramicSize1; } else $neww = $extraSize; // normal photo } $newh = round( $neww/$ratio ); } else{ // portrait if( $type=="main" ) $newh = $mainSize; // main size remains the same if( $type=="extra" ){ if( $ratio < $panoramicPortraitRatio ){ // panoramic photo // calculate new height, but watch out for new width not to be larger than $panoramicSize2 $newh = ( $panoramicSize1*$ratio > $panoramicSize2 ) ? $panoramicSize2/$ratio : $panoramicSize1; } else $newh = $extraSize; // normal photo } $neww = round( $newh*$ratio ); } $image1=imageCreatetruecolor($neww,$newh); ImageAntiAlias($image1, true); imagecopyresampled($image1,$image,0,0,0,0,$neww,$newh,$width,$height); imagedestroy($image); $fontsize=1; imagestring($image1,$fontsize,$neww-195,$newh-10,"W E Builders",$colorwhite); imageinterlace($image1,1); imagejpeg($image1,"",100); imagedestroy($image1); ?>