/** * Calculates a resize dimension box that allows for outbound resize. * The scaled image will be bigger than the requested dimensions in one dimension and then cropped. * * @param BoxInterface $imageSize * @param BoxInterface $requestedDimensions * @return BoxInterface */ protected function calculateOutboundScalingDimensions(BoxInterface $imageSize, BoxInterface $requestedDimensions) { $ratios = array($requestedDimensions->getWidth() / $imageSize->getWidth(), $requestedDimensions->getHeight() / $imageSize->getHeight()); return $imageSize->scale(max($ratios)); }