public function crop(&$image, $cropWidth, $cropHeight, $position = 'center', $offsetX = 0, $offsetY = 0)
{
if ($image->isAnimated()) {
// Ignore animated GIF for now
return $this;
}
if ('smart' === $position) {
// Smart crop
list($x, $y) = $this->_smartCrop($image, $cropWidth, $cropHeight);
} else {
// Turn into an instance of Position
$position = new Position($position, $offsetX, $offsetY);
// Crop position as x,y coordinates
list($x, $y) = $position->getXY($image->getWidth(), $image->getHeight(), $cropWidth, $cropHeight);
}
$x += $offsetX;
$y += $offsetY;
$image->getCore()->cropImage($cropWidth, $cropHeight, $x, $y);
return $this;
}