src/classes/CCImage.php
public function resize_fill( $width, $height ) 
	{
		$original_aspect = $this->width / $this->height;
		$thumb_aspect = $width / $height;

		if ( $original_aspect >= $thumb_aspect )
		{
		   $new_height = $height;
		   $new_width = $this->width / ($this->height / $height);
		}
		else
		{
		   $new_width = $width;
		   $new_height = $this->height / ($this->width / $width);
		}

		$x = 0 - ( $new_width - $width ) / 2;
		$y = 0 - ( $new_height - $height ) / 2;

		$result = imagecreatetruecolor( $width, $height );
		imagecopyresampled( $result, $this->image_context, $x, $y, 0, 0, $new_width, $new_height, $this->width, $this->height );

		// overwrite the image context 
		$this->image_context = $result;

		// update properties
		$this->reload_context_info();

		// return self
		return $this;
	}
public function resize_fill( $width, $height ) 
	{
		$original_aspect = $this->width / $this->height;
		$thumb_aspect = $width / $height;

		if ( $original_aspect >= $thumb_aspect )
		{
		   $new_height = $height;
		   $new_width = $this->width / ($this->height / $height);
		}
		else
		{
		   $new_width = $width;
		   $new_height = $this->height / ($this->width / $width);
		}

		$x = 0 - ( $new_width - $width ) / 2;
		$y = 0 - ( $new_height - $height ) / 2;

		$result = imagecreatetruecolor( $width, $height );
		imagecopyresampled( $result, $this->image_context, $x, $y, 0, 0, $new_width, $new_height, $this->width, $this->height );

		// overwrite the image context 
		$this->image_context = $result;

		// update properties
		$this->reload_context_info();

		// return self
		return $this;
	}
public function resize_fill ( $ width , $ height ) { $ original_aspect = $ this -> width / $ this -> height ; $ thumb_aspect = $ width / $ height ; if ( $ original_aspect >= $ thumb_aspect ) { $ new_height = $ height ; $ new_width = $ this -> width / ( $ this -> height / $ height ) ; } else { $ new_width = $ width ; $ new_height = $ this -> height / ( $ this -> width / $ width ) ; } $ x = 0 - ( $ new_width - $ width ) / 2 ; $ y = 0 - ( $ new_height - $ height ) / 2 ; $ result = imagecreatetruecolor ( $ width , $ height ) ; imagecopyresampled ( $ result , $ this -> image_context , $ x , $ y , 0 , 0 , $ new_width , $ new_height , $ this -> width , $ this -> height ) ; // overwrite the image context  $ this -> image_context = $ result ; // update properties $ this -> reload_context_info ( ) ; // return self return $ this ; }
Resize the image to fill the new size. This will crop your image.

@param int 		$width
@param int 		$height
@return self

@thanks to: http://stackoverflow.com/questions/1855996/crop-image-in-php
Resize the image to fill the new size . This will crop your image .