private static function getDimensions($newWidth, $newHeight, $width, $height, $option = "crop") { switch ($option) { case 'exact': $optimalWidth = $newWidth; $optimalHeight = $newHeight; break; case 'portrait': $optimalWidth = lnpResizeImageHelper::getSizeByFixedHeight($newHeight, $width, $height); $optimalHeight = $newHeight; break; case 'landscape': $optimalWidth = $newWidth; $optimalHeight = lnpResizeImageHelper::getSizeByFixedWidth($newWidth, $width, $height); break; case 'auto': $optionArray = lnpResizeImageHelper::getSizeByAuto($newWidth, $newHeight, $width, $height); $optimalWidth = $optionArray['optimalWidth']; $optimalHeight = $optionArray['optimalHeight']; break; case 'crop': $optionArray = lnpResizeImageHelper::getOptimalCrop($newWidth, $newHeight, $width, $height); $optimalWidth = $optionArray['optimalWidth']; $optimalHeight = $optionArray['optimalHeight']; break; case 'topleft': $optimalWidth = $newWidth; $optimalHeight = $newHeight; break; case 'center': $optimalWidth = $newWidth; $optimalHeight = $newHeight; break; default: $optionArray = lnpResizeImageHelper::getOptimalCrop($newWidth, $newHeight, $width, $height); $optimalWidth = $optionArray['optimalWidth']; $optimalHeight = $optionArray['optimalHeight']; break; } return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight); }