Warning: This function has been deprecated. Use image_resize() instead.

wp_create_thumbnail() WordPress Function

The wp_create_thumbnail() function is used to create a new image file from an existing image. This is useful for creating thumbnails of images to use on your website. The function takes two arguments: the path to the image to be used as the source, and the path to where the new image should be saved. The function will return the path to the new image if successful, or false if it fails.

wp_create_thumbnail( mixed $file, int $max_side, mixed $deprecated = '' ) #

This was once used to create a thumbnail from an Image given a maximum side size.


Description

Top ↑

See also


Top ↑

Parameters

$file

(mixed)(Required)Filename of the original image, Or attachment ID.

$max_side

(int)(Required)Maximum length of a single side for the thumbnail.

$deprecated

(mixed)(Optional)Never used.

Default value: ''


Top ↑

Return

(string) Thumbnail path on success, Error string on failure.


Top ↑

Source

File: wp-admin/includes/deprecated.php

function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
	return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
}


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Use image_resize()
1.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More