function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {}

Create a thumbnail from an Image given a maximum side size.
This function can handle most image file formats which PHP supports. If PHP does not have the functionality to save in a file of the same format, the thumbnail will be created as a jpeg.


  • mixed $file: Filename of the original image, Or attachment id.
  • int $max_side: Maximum length of a single side for the thumbnail.
  • mixed $deprecated: Never used.

Return values

returns:Thumbnail path on success, Error string on failure.

Defined filters

  • wp_create_thumbnail
    apply_filters( 'wp_create_thumbnail', $thumbpath )

Source code

function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {

	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '1.2' );

	$thumbpath = image_resize( $file, $max_side, $max_side );

	return apply_filters( 'wp_create_thumbnail', $thumbpath );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: