wp_shrink_dimensions

函式
wp_shrink_dimensions ( $width, $height, $wmax = 128, $hmax = 96 )
引數
  • (int) $width Current width of the image
    Required:
  • (int) $height Current height of the image
    Required:
  • (int) $wmax Maximum wanted width
    Required:
    Default: 128
  • (int) $hmax Maximum wanted height
    Required:
    Default: 96
返回值
  • (array) Shrunk dimensions (width, height).
相關
  • wp_constrain_dimensions()
定義位置
相關方法
wp_constrain_dimensionswp_expand_dimensionswp_image_src_get_dimensionswp_register_dimensions_supportwp_skip_dimensions_serialization
引入
2.0.0
棄用
3.0.0

wp_shrink_dimensions 是一個用來縮小WordPress中圖片尺寸的函式。

計算一個下采樣影象的新尺寸。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' ); return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); }
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
	return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}

常見問題

FAQs
檢視更多 >