protected function calcHeight($width, $height) { $newHeightPercentage = 100 * $this->maxHeight / $height; $newWidth = $width * $newHeightPercentage / 100; return array('newWidth' => ceil($newWidth), 'newHeight' => ceil($this->maxHeight)); }