wp_create_thumbnail

函式
wp_create_thumbnail ( $file, $max_side, $deprecated = '' )
引數
  • (mixed) $file Filename of the original image, Or attachment ID.
    Required:
  • (int) $max_side Maximum length of a single side for the thumbnail.
    Required:
  • (mixed) $deprecated Never used.
    Required:
    Default: (empty)
返回值
  • (string) Thumbnail path on success, Error string on failure.
相關
  • image_resize()
定義位置
相關方法
wp_create_tagwp_create_termwpmu_create_blogwp_ajax_set_post_thumbnailwp_ajax_set_attachment_thumbnail
引入
1.2.0
棄用
3.5.0

wp_create_thumbnail: 這是一個為文章或頁面建立一個新的縮圖的函式。它可以用來在全尺寸圖片的基礎上自動生成一個縮圖。

這曾經被用來從一個給定最大邊長的影象中建立一個縮圖。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 ) );
}
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 ) ); }
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 ) );
}

常見問題

FAQs
檢視更多 >