Bueno, si haz podido hacer una cosa y no puedes lo otro entonces talvez estés usando un código que otro haya escrito y que no lo entiendes bien, esa sería la única explicación para entender como es que haz tenido el ingenio de hacer una cosa pero no haz podido hacer lo otro. En fin, aquí te dejo el código que hace el recorte:
Código PHP:
function imgCorte($img, $cImg, $we, $he) {
list($w, $h, $tip) = getimagesize($img);
if ($w / $we > $h / $he) {
$hp = $h;
$wp = round(($we / $he) * $hp);
} else {
$wp = $w;
$hp = round(($he / $we) * $wp);
}
$lp = round(($w - $wp) / 2);
$tp = round(($h - $hp) / 2);
$thumb = imagecreatetruecolor($we, $he);
if ($tip == 1) {
$source = imagecreatefromgif($img);
} elseif ($tip == 2) {
$source = imagecreatefromjpeg($img);
} elseif ($tip == 3) {
$source = imagecreatefrompng($img);
}
imagecopyresampled($thumb, $source, 0, 0, $lp, $tp, $we, $he, $wp, $hp);
imagejpeg($thumb, $cImg);
}
Espero que te sirva.