= $targetratio) { //Too Tall $yscale=($interx/$up_x); $temp_h=intval($up_y*$yscale); $temp_img=ImageCreateTrueColor($interx,$temp_h); imagecopyresampled($temp_img, $src_img, 0, 0, 0, 0, $interx, $temp_h, $up_x, $up_y); $cookiecuttop=intval(($temp_h- $intery)/4); $cutout=ImageCreateTrueColor($interx, $intery); imagecopy ($cutout, $temp_img, 0, 0, 0, $cookiecuttop, $interx, $intery ); imagedestroy($temp_img); $src_img=$cutout; } else { //Too Wide or OK $xscale=($intery/$up_y); $temp_w=intval($up_x*$xscale); $temp_img=ImageCreateTrueColor($temp_w, $intery); imagecopyresampled($temp_img, $src_img, 0, 0, 0, 0, $temp_w, $intery, $up_x, $up_y); $cookiecutleft=intval(($temp_w-$interx)/2); $cutout=ImageCreateTrueColor($interx, $intery); imagecopy ($cutout, $temp_img, 0, 0, $cookiecutleft, 0 , $interx, $intery ); imagedestroy($temp_img); $src_img=$cutout; } $old_x=imageSX($src_img); //Scale to requested width $old_y=imageSY($src_img); $dst_img=ImageCreateTrueColor($width,$height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0,$width,$height, $old_x, $old_y); header("Content-Type: image/jpeg"); imagejpeg($dst_img); imagedestroy($dst_img); exit; } if ($_GET['tagsearch']){ $numbr=$_GET['num']; $tag=urlencode($_GET['tagsearch']); $imageout=dosearch($tag,$numbr); processimage(urldecode($imageout), 100, 75); exit; } ?>