private function get_dimensions($new_width, $new_height, $option)
    {
        switch ($option) {
            case 'exact':
                $optimal_width  = $new_width;
                $optimal_height = $new_height;
                break;
            case 'portrait':
                $optimal_width  = $this->get_size_by_fixed_height($new_height);
                $optimal_height = $new_height;
                break;
            case 'landscape':
                $optimal_width  = $new_width;
                $optimal_height = $this->get_size_by_fixed_width($new_width);
                break;
            case 'auto':
                $option_array   = $this->get_size_by_auto($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
            case 'fit':
                $option_array   = $this->get_size_by_fit($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
            case 'crop':
                $option_array   = $this->get_optimal_crop($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
        }

        return array(
            'optimal_width'  => $optimal_width,
            'optimal_height' => $optimal_height,
        );
    }
private function get_dimensions($new_width, $new_height, $option)
    {
        switch ($option) {
            case 'exact':
                $optimal_width  = $new_width;
                $optimal_height = $new_height;
                break;
            case 'portrait':
                $optimal_width  = $this->get_size_by_fixed_height($new_height);
                $optimal_height = $new_height;
                break;
            case 'landscape':
                $optimal_width  = $new_width;
                $optimal_height = $this->get_size_by_fixed_width($new_width);
                break;
            case 'auto':
                $option_array   = $this->get_size_by_auto($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
            case 'fit':
                $option_array   = $this->get_size_by_fit($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
            case 'crop':
                $option_array   = $this->get_optimal_crop($new_width, $new_height);
                $optimal_width  = $option_array['optimal_width'];
                $optimal_height = $option_array['optimal_height'];
                break;
        }

        return array(
            'optimal_width'  => $optimal_width,
            'optimal_height' => $optimal_height,
        );
    }
private function get_dimensions ( $ new_width , $ new_height , $ option ) { switch ( $ option ) { case 'exact' : $ optimal_width = $ new_width ; $ optimal_height = $ new_height ; break ; case 'portrait' : $ optimal_width = $ this -> get_size_by_fixed_height ( $ new_height ) ; $ optimal_height = $ new_height ; break ; case 'landscape' : $ optimal_width = $ new_width ; $ optimal_height = $ this -> get_size_by_fixed_width ( $ new_width ) ; break ; case 'auto' : $ option_array = $ this -> get_size_by_auto ( $ new_width , $ new_height ) ; $ optimal_width = $ option_array [ 'optimal_width' ] ; $ optimal_height = $ option_array [ 'optimal_height' ] ; break ; case 'fit' : $ option_array = $ this -> get_size_by_fit ( $ new_width , $ new_height ) ; $ optimal_width = $ option_array [ 'optimal_width' ] ; $ optimal_height = $ option_array [ 'optimal_height' ] ; break ; case 'crop' : $ option_array = $ this -> get_optimal_crop ( $ new_width , $ new_height ) ; $ optimal_width = $ option_array [ 'optimal_width' ] ; $ optimal_height = $ option_array [ 'optimal_height' ] ; break ; } return array ( 'optimal_width' => $ optimal_width , 'optimal_height' => $ optimal_height , ) ; }
Return the image dimentions based on the option that was chosen.

@param int    $new_width  The width of the image
@param int    $new_height The height of the image
@param string $option     Either exact, portrait, landscape, auto or crop.

@return array
Return the image dimentions based on the option that was chosen .