private function _enforceMaxSize($width, $height, $originalSize, $maintainAspect, $zoomFactor = 1)
{
$adjustedWidth = $width;
$adjustedHeight = $height;
if ($adjustedWidth > $originalSize->getWidth() * $zoomFactor) {
$adjustedWidth = floor($originalSize->getWidth() * $zoomFactor);
if ($maintainAspect) {
$adjustedHeight = floor($height * ($adjustedWidth / $width));
}
}
if ($adjustedHeight > $originalSize->getHeight() * $zoomFactor) {
$adjustedHeight = floor($originalSize->getHeight() * $zoomFactor);
if ($maintainAspect) {
$adjustedWidth = floor($width * ($adjustedHeight / $height));
}
}
return array($adjustedWidth, $adjustedHeight);
}