$srcImg_w) $w=$srcImg_w; if ($h>$srcImg_h) $h=$srcImg_h; $srcImg_w_new = $w; $srcImg_w_new_s = $w/$srcImg_w; $srcImg_h_new = $srcImg_w_new_s*$srcImg_h; if ($srcImg_h_new>$h) { $srcImg_h_new = $h; $srcImg_w_new =($h/$srcImg_h)*$srcImg_w; } header ("Content-type: image/jpg"); $im = @imagecreatetruecolor($srcImg_w_new, $srcImg_h_new) or die("Cannot Initialize new GD image stream"); imagecopyresampled($im,$srcImg,0,0,0,0,$srcImg_w_new,$srcImg_h_new,$srcImg_w,$srcImg_h); imagejpeg($im); imagedestroy($im); ?>