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中图片尺寸的函数。

计算一个下采样图像的新尺寸。

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
查看更多 >