por si le sirve a aguien
Código PHP:
public function crop($width, $height, $margins = false) {
$newImage = imagecreatetruecolor($width, $height);
$ratioW = $width / $this->getWidth();
$ratioH = $height / $this->getHeight();
$ratio = ($margins === false) ? max($ratioW, $ratioH) : min($ratioW, $ratioH);
$newW = floor($this->getWidth() * $ratio);
$newH = floor($this->getHeight() * $ratio);
$this->resize($newW, $newH);
$x = $y = 0;
if ( $this->getHeight() > $this->getWidth() ){
$y = ($this->getHeight() - $height) / 2;
}
else if ($this->getHeight() < $this->getWidth()){
$x = ($this->getWidth() - $width) / 2;
}
imagecopy($newImage, $this->_image, 0, 0, $x, $y, $width, $height);
$this->_image = $newImage;
}