public function getCropSize($originalSize, $transform)
{
$width = $originalSize->getWidth();
$height = $originalSize->getHeight();
$aspect = $width / $height;
if (isset($transform['width']) and isset($transform['height'])) {
$width = (int) $transform['width'];
$height = (int) $transform['height'];
} else {
if (isset($transform['width'])) {
$width = (int) $transform['width'];
$height = floor((int) $transform['width'] / $aspect);
} else {
if (isset($transform['height'])) {
$width = floor((int) $transform['height'] * $aspect);
$height = (int) $transform['height'];
}
}
}
// check if we want to upscale. If not, adjust the transform here
if (!$this->getSetting('allowUpscale', $transform)) {
list($width, $height) = $this->_enforceMaxSize($width, $height, $originalSize, true);
}
return new \Imagine\Image\Box($width, $height);
}