private function get_optimal_crop( $new_width , $new_height )
	{
		$height_ratio	= $this->height / $new_height;
		$width_ratio	= $this->width /  $new_width;

		if ( $height_ratio < $width_ratio ) {
			$optimal_ratio = $height_ratio;
		} else {
			$optimal_ratio = $width_ratio;
		}

		$optimal_height	= $this->height / $optimal_ratio;
		$optimal_width	= $this->width  / $optimal_ratio;

		return array(
			'optimal_width'		=> $optimal_width,
			'optimal_height'	=> $optimal_height
		);
	}
private function get_optimal_crop( $new_width , $new_height )
	{
		$height_ratio	= $this->height / $new_height;
		$width_ratio	= $this->width /  $new_width;

		if ( $height_ratio < $width_ratio ) {
			$optimal_ratio = $height_ratio;
		} else {
			$optimal_ratio = $width_ratio;
		}

		$optimal_height	= $this->height / $optimal_ratio;
		$optimal_width	= $this->width  / $optimal_ratio;

		return array(
			'optimal_width'		=> $optimal_width,
			'optimal_height'	=> $optimal_height
		);
	}
private function get_optimal_crop ( $ new_width , $ new_height ) { $ height_ratio = $ this -> height / $ new_height ; $ width_ratio = $ this -> width / $ new_width ; if ( $ height_ratio < $ width_ratio ) { $ optimal_ratio = $ height_ratio ; } else { $ optimal_ratio = $ width_ratio ; } $ optimal_height = $ this -> height / $ optimal_ratio ; $ optimal_width = $ this -> width / $ optimal_ratio ; return array ( 'optimal_width' => $ optimal_width , 'optimal_height' => $ optimal_height ) ; }
Attempts to find the best way to crop. Whether crop is based on the
image being portrait or landscape.
@param  int    $new_width  The width of the image
@param  int    $new_height The height of the image
@return array
Attempts to find the best way to crop . Whether crop is based on the image being portrait or landscape .