lib/ImageHelper.php
public static function resize( $src, $w, $h = 0, $crop = 'default', $force = false ) {
		if ( !is_numeric($w) && is_string($w) ) {
			if ( $sizes = self::find_wp_dimensions($w) ) {
				$w = $sizes['w'];
				$h = $sizes['h'];
			} else {
				return $src;
			}
		}
		$op = new Image\Operation\Resize($w, $h, $crop);
		return self::_operate($src, $op, $force);
	}
public static function resize( $src, $w, $h = 0, $crop = 'default', $force = false ) {
		if ( !is_numeric($w) && is_string($w) ) {
			if ( $sizes = self::find_wp_dimensions($w) ) {
				$w = $sizes['w'];
				$h = $sizes['h'];
			} else {
				return $src;
			}
		}
		$op = new Image\Operation\Resize($w, $h, $crop);
		return self::_operate($src, $op, $force);
	}
public static function resize ( $ src , $ w , $ h = 0 , $ crop = 'default' , $ force = false ) { if ( ! is_numeric ( $ w ) && is_string ( $ w ) ) { if ( $ sizes = self :: find_wp_dimensions ( $ w ) ) { $ w = $ sizes [ 'w' ] ; $ h = $ sizes [ 'h' ] ; } else { return $ src ; } } $ op = new Image \ Operation \ Resize ( $ w , $ h , $ crop ) ; return self :: _operate ( $ src , $ op , $ force ) ; }
Generates a new image with the specified dimensions.
New dimensions are achieved by cropping to maintain ratio.

@api
@param string  		$src an URL (absolute or relative) to the original image
@param int|string	$w target width(int) or WordPress image size (WP-set or user-defined).
@param int     		$h target height (ignored if $w is WP image size). If not set, will ignore and resize based on $w only.
@param string  		$crop your choices are 'default', 'center', 'top', 'bottom', 'left', 'right'
@param bool    		$force
@example
```twig
<img src="{{ image.src | resize(300, 200, 'top') }}" />
```
```html
<img src="http://example.org/wp-content/uploads/pic-300x200-c-top.jpg" />
```
@return string (ex: )
Generates a new image with the specified dimensions . New dimensions are achieved by cropping to maintain ratio .